I have a visitor logging script that I want to be run on all pages
so I kept it in appController's beforeFilter method as below
public function beforeFilter() {
//log visitors starts here
if( $this->Session->check('visited') == true )
{
//logging code
}
else
{
$this->Session->write('visited') = true; //this line gives error
}
//log visitors ends here
}
I am getting the following error
Fatal error: Class declarations may not be nested in D:\wamp\www\myproject\lib\Cake\Error\ExceptionRenderer.php on line 54
by commenting session writing line shown below, page runs without ant error
$this->Session->write('visited') = true;
I alse changed this code to afterFilter and beforeRender methods but still error