Hi Everyone,
I want to add a variable to the SiteController. The variable is a CActiveRecord model, and I wrote a function that set it.
When I call this function from the actionIndex for example it works fine. But I want it to run before any action.
So I wrote a construct function:
public function __construct()
{
parent::__construct($this->id, $this->module);
$this->web=$this->getWeb();
}
And then I got an error:
What wrong? What is the way to do that? (Is there a better way to do that?)
Thanks a lot!
note
I found the solution of the ‘init’ function. But I still not understand what was wrong in my way.