CakePHP: Insert name and path into CTP files in views and elements

I am looking for an elegant way to make a little jquery aware of the file name and path to the ctp file containing the given dom selection. I use simple_html_dom to write changes to template flies through an ajax call. I need to specify the file name and path to the ctp file of the presentation template or element that contains the dom element that I selected in order to write the changes to the correct file.

Beyond manually transferring this information to every view and element in my application, is there an elegant (and safe) way to make this information available to jquery?

Also, is there any reason why I should worry about pasting this information into plain text? What is the most suitable place to store it? My first thought was in the title attribute of the element, but is there a more appropriate location?

Thank!

UPDATE . This question can be better posed as: what is the best way to transparently expand or change each kind and element in the cake? I am passing some information from app_controler to beforeRender now, but this does not allow me to transfer file information of individual elements as far as I know. Ideally, each element and element will look for the presence of a particular class in the dom elements and insert the path and file name into the title attribute for that element before rendering. I can’t find a good way to do this!

+3
source share
2 answers
<div rel="<?php echo __FILE__; ?>">...</div>

if i don't understand you

0
source

View, . "views" (): custom.php.

, CakePHP "CustomView". AppController beforeFilter $this- > view = 'Custom'. , , , render() renderLayout(), , .

0

Source: https://habr.com/ru/post/1763332/


All Articles