I have this code, I need (for every page) to read a session, if
doesn't exist read from a model and then write the session, something
like:
======================
function beforeFilter()
{
// read session variable
$id = $this->Session->read('editable_season_id');
// id doesn't exist
if((is_null($id)) || (!is_numeric($id)))
{
// find it
$id = $this->MyModel->getLastSeasonId();
$this->Session->write("editable_season_id", $id);
}
}
======================
If I put it inside appController I can't use $this->MyModel,
but if I put it inside appModel I can't use $this->Session.
So.... where I should insert that code???
--
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