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 =)

Advertisements

9 thoughts on “Integrate CakePHP and jQuery UI”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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