Let's say $a = '123', in index() in users_controller.
If we want to use the $a in users/index, we can use set() and compact():
$this->set(compact('a'));
*set() : Send data from controller to view.
**compact() : Creates an array containing variables and their values.
***Note that we need to remove the dollar($) sign when using compact().
Reference:
1. Stupid CakePHP Controller Tricks
2. Interacting with Views
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment