Yii Module Theme

Hi, So I have a crm module that I want to be able to theme, but if i query Yii:app()->theme from within the module it returns null. How would u set a module specific theme, and where would you place the theme directory, in root/themes or in module/themes?


I’ve developed something similar, I share themes between modules, so I’ve created a BaseWebModule component, from which I extend all my modules.

In my case, the problem was related to layout paths, not to Yii::app()->theme returning null


public function beforeControllerAction($controller, $action)


		if(parent::beforeControllerAction($controller, $action))


		    // this method is called before any module controller action is performed

		    // you may place customized code here






			return true;



			return false;


I also added the following to a custom component BaseController.php

public function init(){

     Yii::app()->theme = Yii::app()->user->getCurrentTheme();  //do some logic to load the desired theme


Extended all my controllers from BaseController.php

I’ve put all my themes under webroot.themes

I think that it should work for you as the mechanism is almost the same

Hope this helps!