0
votes

How to call a action controller in module?

I access the url with the address

"example.com/admin/test"


I've action controller test like this

protected-modules-admin-controllers-AdminController-actionTest

but the output is

Error 404 Unable to resolve the request "admin/test".

if i call controller actionTest

protected-controllers-UserController-actionTest

and i access the url

"example.com/user/test"


it can, there is no problem

thanks for the help

2

2 Answers

1
votes

moduleID/controllerID/actionID

yourdomain/admin/admin/test

0
votes

Solved

I change the index.php to

foreach (glob(dirname(__FILE__).'/protected/modules/*', GLOB_ONLYDIR) as $moduleDirectory) {
        $this->setModules(array(basename($moduleDirectory)));
}
return parent::init();

and also the main config url

'urlManager'=>array(
                        'urlFormat'=>'path',
                        'showScriptName'=>true,
                        'rules'=>array(

                                'admin/<action:\w+>'=>'admin/admin/<action>',

likai thanks for the help now i can access action like yourdomain/admin/admin/test or yourdomain/admin/test :)