Integrate CakePHP and jQuery UI

jQuery UI provides many fancy user interfaces for web developers. You can follow the steps below in order to use jQuery UI in CakePHP.

1. Download the jQuery UI library at jqueryui.com
 

2. Unzip the downloaded archive and copy the css folder and two .js files to <CAKEPHP_PROJECT>/app/webroot

  • css/<THEMEAME>
  • js/jquery-1.4.2.min.js
  • js/jquery-ui-1.8.4.custom.min.js

 

3. Add the following lines in your view file where you want to use the jQuery UI components

<?php echo $html->script('jquery-1.4.2.min.js'); ?>
<?php echo $html->script('jquery-ui-1.8.4.custom.min.js'); ?>
<?php echo $html->css('<THEME_NAME>/jquery-ui-1.8.4.custom.css'); ?>

 

4. Let’s add a date picker in a text box as a trial

<!-- jQuery UI trial -->
<input type="text" name="date" id="date" />
<script type="text/javascript">
	jQuery(document).ready(function($){
		$('#date').datepicker();
	});
</script>

 

5. Here is what i got

 

Done =)

9 thoughts on “Integrate CakePHP and jQuery UI”

Leave a reply to NO13ODY Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.