Passing variables between layout

Hello, I just started using Yiic framework and would like to know how to pass variable from controller to layout.


  1. I’m using a controller that uses the default column1.php layout that uses the main layout file. Is there a way for me to declare a php variable in the main.php layout file and gets used in the column1.php file. Or is there a way for me to pass data from the controller to the main.php layout files? I’m trying to set the asset url in main.php but it doesn’t carried to column1.php.


Check this similar thread -

I ended up putting some frequent logic in a base controller class, like explained in this wiki article:

But pretty much like in the topic linked to.