I have created a module to use an administration to the rest of the project but it is defaulting to the main layout files and I want to change my menu.
class AdminModule extends CWebModule
{
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
$this->setImport(array(
'admin.models.*',
'admin.components.*',
));
$this->layout = 'main';
}
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;
}
else
return false;
}
}
But it will not read the layout files in their. Reads the layout files in
class AdminModule extends CWebModule
{
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
$this->setImport(array(
'admin.models.*',
'admin.components.*',
));
$this->layoutPath = Yii::getPathOfAlias('application.modules.admin.views.layouts');
$this->layout = '/layouts/main';
}
...
The module layouts column1 and column2 in views/layouts/
Sorry have been away on holiday. Putting $this->layout = "column1"; in the index.php file of my admin modules folder has worked but surely this is not correct. Its not working in in the init function of AdminModule but it is inside the view file.