Parent/Child Theme

I’m creating an app with many modules. Each module has it’s own distinct theme. However, the theme’s are all variations of a common base theme. I’d like to create a base theme with javascript, css, views, etc that become defaults, and each module-specific theme can override or extend the default with extras that pertain only to that theme.

Is there a mechanism for this within Yii?

If you’re familiar with the Yii layouts and views, you’ll know that a typical theme will have a main.php layout, a column1.php layout, and a column2.php (etc) layout file if appropriate. The main.php file can be used directly, but usually for a single column layout, you’ll use column1.php for the layout which in turn calls main.php. Likewise, column2.php will typically use main.php. Main.php will usually contain references to css and javascript.

If you use main.php to define all of the common elements of your theme. You could create column1_a.php, column1_b.php, …,column2_a.php, column2_b.php,… where module specific css/javascript is added. If it is necessary to override css from main.php, this thread describes a solution for controlling the order of your css files. The css cascading rules apply.

So, while there isn’t a specific mechanism to do what you want, it should be possible with planning to do it.