I have a problem. I don't know where to put jQuery EasyUI in CakePHP? Which folder?
Do I use it like a helper?
Do I have to put something like:
var $helpers = array('jQuery');
Do I have to put some in view?
Thank you so much for your help always. :)
Edit:
And if you can give me some online tutorials with jQuery EasyUI with CakePHP 2.x. (I already Google it.) :D
Upload the jQuery & jQuery EasyUI source code to your /app/webroot/js directory
Link to them in your layout (if you want it included in all your pages) or in individual views with:
(Replace jquery.js and jquery-easyui.js filenames with the actual filenames)
One you have the libraries loading properly (use Firebug to check ;-), you should be able either with inline scripts (not recommended) or by loading external scripts:
Note: The order you include them is important.
As this question is for CakePHP 2.x the correct answer is:
Notice that there is no extension for the JavaScript file. The script() function of the HtmlHelper includes script files from the app/webroot/js forlder. You can also load multiple script files:
Script dependance and precedence also have a role here. This means that if say scriptA.js depends on scriptB.js, the later must be loaded first:
When you're loading a plugin of jQuery you must watch over this as well. Notice that in the example I gave for loading multiple script files shows this.
In CakePHP javascript files are stored in app/webroot/js/.
You then can include them in the layout by calling
You can then write your javascript code in either the view or another external js file.