Cakephp Classroom image

osdyui
 
To post your Question Join Classroom
 
Lesson Topics's No:-  First|7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15|Last
Lessons:-Controllers

Controller Attributes
For a complete list of controller attributes and their descriptions visit the CakePHP API. Check out
http://api20.cakephp.org/class/controller.
property Controller::$name
The $name attribute should be set to the name of the controller. Usually this is just the plural form
of the primary model the controller uses. This property is not required, but saves CakePHP from
inflecting it:
// $name controller attribute usage example
class RecipesController extends AppController {
public $name = ’Recipes’;
}
$components, $helpers and $uses
The next most often used controller attributes tell CakePHP what helpers, components, and models
you’ll be using in conjunction with the current controller. Using these attributes make
MVC classes given by $components and $uses available to the controller as class variables
($this->ModelName, for example) and those given by $helpers to the view as an object reference
variable ($this->{$helpername}).
Note: Each controller has some of these classes available by default, so you may not need to configure your
controller at all.
property Controller::$uses
Controllers have access to their primary model available by default. Our RecipesController will have
the Recipe model class available at $this->Recipe, and our ProductsController also features the
Product model at $this->Product. However, when allowing a controller to access additional
models through the $uses variable, the name of the current controller’s model must also be included.
This is illustrated in the example below.
If you do not wish to use a Model in your controller, set public $uses = array(). This will
allow you to use a controller without a need for a corresponding Model file. However, the models
defined in the AppController will still be loaded. You can also use false to not load any
models at all. Even those defined in the AppController Changed in version 2.1: Uses now has a
new default value, it also handles false differently.
property Controller::$helpers
The Html, Form, and Session Helpers are available by default, as is the SessionComponent. But if you

 
 
 

osdyui

Skills    Cakephp

Qualifications :-
Location :-,,,
Description:-
Explore
 

  Students (0)