In ProjectsController.php I'm setting a session variable as I'd like that info to be accessible in ALL controllers, models and views:
$this->Session->write('Project.title', $this->Project->title);
Now, when I try access it from Projects view, like this:
<p>Project: <strong>
<?php if (isset($session->read('Project.title'))):
$session->read('Project.title');
?>
<?php else: ?>
Not selected
<?php endif; ?>
</strong></p>
I'm getting the following error:
Fatal error: Can't use method return value in write context
Which refers to the second line of above code.
I've been through CakePHP documentation and also searched SO, what am I doing wrong here?
Thanks!
EDIT:
I've also tried using:
$this->Session->read('Project.title')
resulting in the same error message.