Friday, August 23, 2013

Loading {controller_name}/{view_name}.js files automatically

After having this code lying around for months, I've made a plugin to load specific .js files for views. Default functionality is:

for app/View/Article/view.ctp

A: check existence and include:
 app/View/Article/view.js

or

B: check existence and link to:
app/webroot/js/article/view.js

In the first mode, it can also evaluate the .js file for PHP code and feed the viewVars into it.

I've kept it quite simple and light with a component/helper pair, it would be awesome if someone could help me and try it out, debug, comment, throw ideas, or whatever...

Check it out here:

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: