Interview Questions

What is the use of $this->set();

CakePHP Interview Questions and Answers


(Continued from previous question...)

What is the use of $this->set();

The set() method is used for creating a variable in the view file.Say for example if we write, $this->set('posts',$posts); in controller fie, then the variable $posts will be available to use in the view template file for that action.

(Continued on next question...)

Other Interview Questions