One default layout with many themes

Hi guys. The problem is: At the config main file(CWebApplication),i set the theme but i wanna keep the default root layout(protected/views/layout or whatever). I did this at config/main.php:




But the layout of theme customUser always override default root layout. What i doing wrong?


The theme layout, if it exists, always overrides the default layout with the same name. If you remove (or better yet, rename) the main.php file in your theme(s), the app will revert to the default layout. Give it a try.

BUT, do you really want to do that? Typically, the main.php file includes references to stylesheets, etc. that control the look of the theme. If you switch to the default layout, you lose all of that. Which means that setting the theme in the config file won’t really have any impact.

It is possible to put very little in the way of CSS, etc. in your layout files, and to use the "register" methods to load script and css files in individual views. That defeats the whole purpose of having a theme, but you could do it.