The primary theme attribute in the config is going to update for the whole site. You can’t set it as a param on the module in the config, because CModule doesn’t have a theme property, but you can add it to the init section of the Module class by setting
Yii::app()->theme = 'themename';
which will set it just for that module while it’s in use.
This is not working for me?? I have ‘theme’=>‘new’, in config/main.php which is expected to be inherited by any modules - ie, set the theme for the site, however both modules admin and shop refer back to the default theme??? I tried just setting the recommended global:
public function init()
{
$this->setImport(array(
'shop.models.*',
'shop.components.*',
));
Yii::app()->theme = 'new';
}
but the ‘new’ theme is not getting used in the module??
This is not working for me?? I have ‘theme’=>‘new’, in config/main.php which is expected to be inherited by any modules - ie, set the theme for the site, however both modules admin and shop refer back to the default theme??? …[/code]
I had the exact same problem. I was extending the Trackstar project from the Agile Yii book. using Yii 1.1.8
I want my module to inherit the theme and layout from
webroot.themes.new.views.layouts.main.
Tried all of the suggestions above with no luck.
I got it to work by explicitly declaring the $layout property of each controller the module using dot notation like this:
[i]
This code works in modules/MyModule/SomeController[/i]
class SomeController extends Controller
{
...
public $layout = 'webroot.themes.new.views.layouts.main';
...
}
I have tried to set $this->layoutPath and $this->layout in the module init() function, but it is being ignored.