I've been struggling with another framework, so I decided to try this one. I'm so glad I've decided to try this one, I have achieved more with this in a couple of days than with the other in 3 months. The documentation here is very good.
I've been reading a lot of tutorials and threads here in the forum, but I could not get a clear answer to this. But maybe my head is full of crap with the approach of other frameworks.
Can I inject some variables to the layout (template)? What I want to do is in some action of the controllers pass a variable to the layout.
Usually I use a separate css file for forms, but if I don't use any forms I don't need to put the link on the head of the document (layout). This could also apply to javascript files, maybe in one view we need some javascript files and in other we don't.
So I tried on the action of the controller
public function actionIndex (){
$this->render('index', array('headCSS'=>CHtml::cssFile('/css/forms.css','screen')));
}but $headCSS or $this->headCSS wasn't available at the layout.
The only thing that is available here is the $content variable, the $data passed in the render method is not available.
It was very good in the head of the layout I could add something like
<head> <?php echo $headCSS; ?> // or $this->headCSS </head>
Am I missing anything??
I think I saw a solution for this with a widget. Is this the correct approach??
Thank you

Help












