Hi
Can build a module in another module in yii ?!?
Hi
Can build a module in another module in yii ?!?
Yes you can. Follow this steps :
Run the gii module (www.example.com/gii/) and click Module Generator. Then in the Module ID box enter the Id of the module (for example admin).
Enable the module in config file:
'modules'=>array(
'gii'=>array(
'class'=>'system.gii.GiiModule',
'password'=>false,
'ipFilters'=>array('127.0.0.1','::1'),
),
'admin', // add the new module
),
Run the gii again (www.example.com/gii/) and generate another module (for example blog).
Go to in your project and in protected/modules/admin Create a new folder called modules
Move the blog folder (protected/modules/blog) to the protected/modules/admin/modules/ folder.
Open protected/modules/admin/AdminModule.php file and import the nested module :
class AdminModule extends CWebModule
{
public function init()
{
parent::init();
$this->setModules(array(
'blog',
));
}
}
I followed your instructions, but I get 404 error (Unable to resolve the request). Currently
localhost/testdrive/test
works well but
localhost/testdrive/test/fest
yields 404. The modules parameter in config/main.php file looks like below:
'modules'=>array(
'test' => array(
'modules' => array(
'fest',
),
),
'gii'=>array(
'class'=>'system.gii.GiiModule',
'password'=>false,
'ipFilters'=>array('127.0.0.1','::1'),
),
),