Installation
- Download and unpack helper files
- Put helper files (ajax.php and javascript.php) in your helpers directory (/app/views/helpers/)
- Copy javascript libraries (jquery-1.4.2.min.js or higher is required. Other libs should be there if you use methotds that require them) into /app/webroot/js/ directory
- Add javascript libs to layout (/app/views/layouts/default.ctp) by adding following line (for every javascript library):
<?php echo $javascript->link('jquery-1.4.2.min');?> - Add helpers to used helpers in your controller or app_controller
var $helpers = array([...], 'Javascript', 'Ajax');
Installation on CakePHP 2.x
Thanks to László Üveges for new version.
- Download and unpack helper files for CakePHP 2.0
- Put helper files (AjaxHelper.php and JavascriptHelper.php) in your helpers directory (/app/View/Helper/)
- Copy javascript libraries (jquery-1.4.2.min.js or higher is required. Other libs should be there if you use methotds that require them) into /app/webroot/js/ directory
- Add javascript libs to layout (/app/Views/Layouts/default.ctp) by adding following line (for every javascript library):
<?php echo $this->Javascript->link('jquery-1.4.2.min');?> - Add helpers to used helpers in your controller or app_controller
var $helpers = array([...], 'Javascript', 'Ajax'); - In examples in view files I'm using old reference to helper methods. From CakePHP 2.0 you should use
<?php echo $this->Ajax->link(...);?>instead of<?php echo $ajax->link(...);?>
After these five steps you are ready to use this helper.
Additional steps for localization files
- Look for the desired file in http://jquery-ui.googlecode.com/svn/trunk/ui/i18n/
- Download and put into /app/webroot/js/ directory
- Add javascript lib to layout (/app/views/layouts/default.ctp , like in the basic Instalation guide)
License terms
Copyright (c) 2009 Damian Jóźwiak
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.