I am setting variables in AppController in order to use them in
default.ctp.
This is my code:
function beforeRender ( )
{
@Controller::loadModel('User');
$login_url = [trimmed];
$this->set('loginurl', $login_url);
$this->set('user', $this->Cookie->read('User'));
$this->set('examdata', $this->User->query('select listing from
exams
limit 0,1'));
$this->set('exam', $this->Cookie->read('exam'));
}
The logic for above code has been performed in beforeFilter().
Now when I use the variables in default.ctp, such as say $loginurl, or
$examdata, I get:
Undefined variable: loginurl
or Undefined variable: examdata
What am I doing wrong?
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others
with their CakePHP related questions.
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php