views:

101

answers:

1

I'm looking for an elegant way to make a bit of jquery aware of the filename and path of the ctp file containing a given dom selection. I'm using simple_html_dom to write changes to template flies via an ajax call. I need to provide the filename and path of the view or element template ctp file that contains the dom element I've selected in order to write changes to the correct file.

Outside of manually passing this information into each and every view and element in my application, is there an elegant (and secure) way to make this information available to jquery?

Additionally, is there any reason I should be worried about embedding this information in the document in plain text? What is the most appropriate location to store it? My first thought was in an element's title attribute, but is there a more appropriate location?

Thanks!

UPDATE This question may be better posed as: what is the best way to transparently extend or modify every view and element in cake? I'm passing some information down from app_controler in beforeRender now, but that doesn't allow me to pass information about individual element view files as far as I'm aware. Ideally, every view and element would look for the presence of a certain classname in dom elements and insert path and filename information in the title attribute for that element before rendering. I can't figure out a good way to do this!

A: 
<div rel="<?php echo __FILE__; ?>">...</div>

unless im not understanding you

dogmatic69