Archive for the ‘CakePHP’ Category

CakePHP Setting up your system to Bake

Tuesday, February 1st, 2011
start baking:

C:\xampp\htdocs\project\app>”../cake/console/cake” bake

Starting a new project with CakePHP

Tuesday, February 1st, 2011

download the current release:

unzip, copy/rename folder as desired

check apache file permissions
app/tmp – 0777

core.php – change Security.salt to new value
database.php.default – remove .default, and configure values according to your database


CakePHP naming conventions

Tuesday, February 1st, 2011

URL will trigger controller

in app/controllers:
in there:
class DataUsersController extends Controller {

this should be the same as the table it will reference:

in app/models:
class data_user extends AppModel {

in app/views/data_users:

CakePHP Time Helper: how to use it in a view

Monday, March 8th, 2010

First of all, in the controller, add it to the $helpers array:

var $helpers = array(‘Html’, ‘Form’, ‘Time’);

Then in the corresponding view, call it like this:

<p>Date Published: <?=$time->nice($post[‘Post’][‘date’]);?></p>

which effectively (in this case from the database in this example) turns this: 2010-01-02 21:54:00

into this: Sat, Jan 2nd 2010, 21:54

—- note: —-

without the Time helper we could of course do this specific thing with the plain ‘ol PHP date function this way:

<?=date(‘M jS Y, g:i a’,strtotime($post[‘Post’][‘date’]));?>


$post[‘Post’][‘date’] is the value of the object Time will beautify, in this case

sent by the following function in the controller:

function view($id = null) {

if (!$id) {

$this->Session->setFlash(__(‘Invalid Post.’, true));

$this->set(‘post’, $this->Post->read(null, $id));


CakePHP debug

Monday, March 8th, 2010

need to see inside that specified array?

to be remembered:


<? debug($post); ?>

which will also display records from associated models!

CakePHP Setting up command line to bake

Monday, March 1st, 2010

start baking:

C:\xampp\htdocs\project\app>”../cake/console/cake” bake