Hello, I have created a Module with Gii named admin. changed default controller to:
class DefaultController extends CController // I have removed /protected/component/controller.php
{
public function actionIndex()
{
$this->render('index');
}
}
[b]
[/b]Then have set /protected/config/main.php:
'modules'=>array(
// uncomment the following to enable the Gii tool
'gii'=>array(
'class'=>'system.gii.GiiModule',
'password'=>'pass',
// If removed, Gii defaults to localhost only. Edit carefully to taste.
'ipFilters'=>array('127.0.0.1','::1'),
),
'admin',
),
Then have copy the /protected/views/layouts directory on protected/modules/admin/views/.
protected/modules/admin/views/layouts/admin.php:
beginContent('//layouts/main') ?>
<div id='admin' class="content">
<?php echo $content ?>
</div>
endContent() ?>
Then i have overridden $layout property in protected/modules/admin/AdminModule.php so that all controllers(AdminModule->controllers) can use this layout:
class AdminModule extends CWebModule
{
public $layout='//layouts/admin';
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.*',
));
}
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 when go ahead with http://localhost/web...dex.php?r=admin encountered with this error:
Property "DefaultController.layout" is not defined.
How can i set default layout in AdminModule so that all controllers will can use that default layout?