How to pass a parameter to layout page

Hello…

In SiteController I have this code:




$this->render('contact',array('contact'=>$contact, 'c'=>1));



I can retrieve value of c parameter using simply $c in site/contact.php page, but I cannot do it in layouts/main.php page.

How can i do it in layout page?

Thanks

Jaime

Please search before starting new topics.

http://www.yiiframework.com/forum/index.php?/topic/4473-how-to-pass-variable-to-a-layout/page__view__findpost__p__23770

Thanks and sorry for making you to waste your time. However, I didn’t like any solutions proposed there, So before trying to implement the cleaner one, I’ll tell you that I need actually to know which view was loaded in the layout. I was trying to pass a parameter from the controller that renders the view so that I could use that parameter for my purpose.

Is there a way for the layout to know which view was loaded? I was looking at CController methods and properties but I didn’t find a way to do that. If there is not a way, I will need to implement your solution about creating a BaseController derived class with that parameter.

Thanks

Jaime