I am trying to define nested modules, but I couldn't find any complete explanations in the tutorials.
I have a module admin and I want to add another module inside it imgManager, here is my directory structure:
protected
...
modules
admin
...
modules
imgManager
...
...
I defined the nested modules in my main config file like this:
'modules'=>array(
...
'admin'=> array(
'modules'=>array(
'imgManager' => array(
'import'=>array('imgManager.*','imgManager.components.*'),
'layout'=>'application.views.layouts.column1',
'upload_directory'=>'gal_images',
'max_file_number' => '10',//max number of files for bulk upload.
'max_file_size' => '1mb',
),
),
),
),
And here is my urlManager:
'components'=>array(
...
'urlManager'=>array(
'urlFormat'=>'path',
'showScriptName'=>false,
'rules'=>array(
'admin'=>'admin',
'admin/<controller:\w+>'=>'admin/<controller>',
'admin/<controller:\w+>/<action:\w+>'=>'admin/<controller>/<action>',
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
),
),
I need to access to this nested module like this: mydomain.com/admin/imgManager but I get Error 404 Unable to resolve the request "admin/imgManager". Where am I doing wrong?
I had to define the module also in here:
class AdminModule extends CWebModule
{
public function init()
{
...
$this->setModules(array('imgModule'));
}
...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With