Archive for the ‘Controllers’ Category

loadModel

Sep 20, 2007

Provide access to a model from a Component
Say you have a model called FoosFum in a file called foos_fum.php

loadModel('FoosFum');
$this->FoosFum = &new FoosFum();

Limit the size of your controller

If you only use a model in certain circumstances do not use the $uses array, use loadModel where you need it.

 

References:
http://manual.cakephp.org/chapter/controllers
Google Group
http://manual.cakephp.org/chapter/components

 

 

Not So Stupid Trick… compact()

Aug 16, 2007

Here is a good post that explains how to make several local variables available to the view at once.

Of course, you can always reference $this->data in the view…