Category Archives: CakePHP

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 Continue reading Integrate CakePHP and jQuery UI

CakePHP – Apply Time Zone for Users

Update @ 2012-09-25: This approach could not handle the DST zones. Thanks for the comment made by Lucas. =)

You can make use the TimeHelper to offset the time by user specified time zone. What u need is adding a new time_zone column in the users table just like the following example.

--MySQL
CREATE TABLE IF NOT EXISTS users (
	user_id INT NOT NULL auto_increment,
	name VARCHAR(45) NOT NULL,
	password VARCHAR(45) NOT NULL,
	time_zone DECIMAL(5,1) NOT NULL,
	created DATETIME DEFAULT NULL,
	PRIMARY KEY (user_id)
) ENGINE = InnoDB;

Continue reading CakePHP – Apply Time Zone for Users

Ajax implementation on CakePHP @ 3

Recently i have started another CakePHP project. i found that the example in Ajax implementation on CakePHP @ 2 should be changed as follow.

ajax_controller.php

<?php
Class AjaxController extends AppController {
	var $name = 'Ajax';
	var $helpers = array('Form','Html','Javascript', 'Ajax');
	var $components = array('RequestHandler');

	function afterAjaxAction () {
		// get the $this->data to collect the form information
		// save the object to database
		// render the after_ajax_call.ctp
		$this->render('/elements/layout/after_ajax_call');
	}
}

Continue reading Ajax implementation on CakePHP @ 3

CakePHP – Email Validation

After working for about one year, the BHJS Alumni website phase 2 is completed. But after it is deployed in production server, i found that some email addresses are regarded as invalid email address. The email validation rule which i used is provided by CakePHP. Only email addresses ended with .com, .org etc… could pass the validation rule.

So i ask the Google teacher and luckily i am not the only one to come across this problem.
Continue reading CakePHP – Email Validation