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
$layoutPath= Yii::getPathOfAlias('application.modules.admin.views.layouts');
$this->setLayoutPath($layoutPath);
//$viewPath=...path to views if needed...;
//$this->setViewPath($viewPath);
return true;
}
else
return false;
}
not tested, dump the getPathOfAlias to see if it is the correct path you want
Lastly, I figure out the solution of this problem.
In fact it is the path problem in the layout files in /protected/modules/admin/view/layouts.
The overall structure is this:
ROOT
- modules
- admin
- modules
- catalog
CatalogModule.php
public function init()
{
// this method is called when the module is being created
// you may place code here to customize the module or the application
// import the module-level models and components
parent::init();
$this->setImport(array(
'catalog.models.*',
'catalog.components.*',
));
// Add this two line to override the layoutPath
$layoutPath= Yii::getPathOfAlias('application.modules.admin.views.layouts');
$this->setLayoutPath($layoutPath);
}
And the column1 layout under /protected/modules/admin/view/layouts
The parameter in $this->beginContent() should be using Path Alias:
Basically, you have to add those code in your AuthModule.php and you have to edit the layouts placed in /protected/modules/admin/views/layouts/
AuthModule.php
public function init() {
//Your Own Code Here...
// Add this two line to override the layoutPath
$layoutPath= Yii::getPathOfAlias('application.modules.admin.views.layouts');
$this->setLayoutPath($layoutPath);
}
column1.php (for example), change //layouts/main to application.modules.admin.views.layouts.main