Pass parameters in layout

Hi,

Still learning stuff…

I want to be able to pass parameters in the layout used in the application. How is this possible?

What I actually want to do is to pass a different jquery script for each controller action. I can pass the script for each different view, but it would be nicer to include the script in the <head> tag of the page, which happens to exist in the layout (main.php).

Thanks.

You can use Yii::app()->clientScript->registerXXX() to register script and files in the head section. If you still want to pass variables to layout, you may define properties in your controller and then access them in your layout.

Thanks qiang, I’ll try your suggestions. :)