I need a display element according to whether the user is logged or not – In CakePHP 2.0
This does not work
<?php
if ($this->Auth->loggedIn()
{
echo $this->element('user');
}
else
{
echo $this->element('guest');
}
?>
Thanks
Follow the MVC pattern and put the logic in the controller.
In the controller:
In the view: