Cakephp Classroom image

Anil  Bist / Professional / Web Technology

 
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

 
 
 
image
Anil  Bist

Skills    Cakephp

Qualifications :- High School - SLV, College/University - Graphic Era Deemed Univ University,
Location :-Dehradun,Dehradun,Uttarakhand,India
Description:-

I started my Professional Journey in 2006 with one of the Web Development Company in Bangalore and my 1st framework was "Ruby on Rail" as Web development and delivered around 5+ Projects using this platform. Then came another dimension as JEE/Sturst framework, Gradually I realized that I want to build something on my own and give my passion and energy on creating something different a
Explore

 

  Students (0)