"sitecontroller Cannot Find The Requested View "index"."

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.

1)In your view create the site folder and create the index.php file on site folder…

2)In sitecontroller.php create the index action and render the view (index)


public function actionIndex(){

$this->render('index');

}

There is a index.php file in the view folder…

code.google.com/p/yii/issues/detail?id=2776

$this->render(‘site/index’);