Hi there.
I have a main app with /layouts/main.php layout and a module named ‘admin’ in it with /layouts/main.php layout file. Problem is, when Im moving from main page localhost/avd/index.php/site to main page of admin the URL become like this localhost/avd/index.php/admin and I don
t see layout specified in admin module, instead I see the “old” main layout. What is the reason?..
AdminModule.php
<?php
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;
}
}
DefaultController.php //admin
<?php
class DefaultController extends Controller
{
public function actionIndex()
{
$this->render('index');
}
}
Controller.php //whole app
<?php
class Controller extends CController
{
public $layout='//layouts/column1';
public $menu=array();
public $breadcrumbs=array();
}
snippet from /protected/config/main.php
...
'modules'=>array('admin', ...