Thursday, February 2, 2012

Undefined variable error when not logged in

I get the following error when accessing a page "persons/edit/1" when
not logged in:
Undefined variable: logged_in [APP\View\Layouts\default.ctp, line 43]

The code in the app controller is as follows:
function beforeFilter() {
$this->Auth->authError = 'You cannot access that page.';
$this->Auth->loginError = 'Incorrect username or password, please
check!';
$this->Auth->loginRedirect = array('controller' => 'people', 'action'
=> 'index');
$this->Auth->logoutRedirect = '/';
$this->set('logged_in', $this->_loggedIn());
$this->set('username', $this->_username());
}

function _loggedIn() {
if ($this->Auth->user())
return true;
return false;
}

Any ideas?
Thanks

--
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
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: