Cakephp Classroom image

pankaj
 
To post your Question Join Classroom
 
Lesson Topics's No:-  First|1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9|Last
Lessons:-Controllers

Controller Methods
For a complete list of controller methods and their descriptions visit the CakePHP API. Check out
http://api20.cakephp.org/class/controller.
Interacting with Views
Controllers interact with the view in a number of ways. First they are able to pass data to the views, using
set(). You can also decide which view class to use, and which view file should be rendered from the
controller.
Controller::set(string $var, mixed $value)
The set() method is the main way to send data from your controller to your view. Once you’ve
used set(), the variable can be accessed in your view:
// First you pass data from the controller:
$this->set(’color’, ’pink’);
// Then, in the view, you can utilize the data:
?>
You have selected <?php echo $color; ?> icing for the cake.
The set() method also takes an associative array as its first parameter. This can often be a quick
way to assign a set of information to the view. Changed in version 1.3: Array keys will no longer be
inflected before they are assigned to the view (‘underscored_key’ does not become ‘underscoredKey’
anymore, etc.):
$data = array(
’color’ => ’pink’,
’type’ => ’sugar’,
’base_price’ => 23.95
);
// make $color, $type, and $base_price

 
 
 

pankaj

Skills    Cakephp

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

  Students (0)