Yii - Access Actioncontroller In Modules

Hi all,

How to call a action controller in module?

I access the url with the address

I’ve action controller test like this

but the output is

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

if i call controller actionTest

and i access the url

it can, there is no problem

thanks for the help

Dear Friend

When calling a controller upon handling a request, YII does the following.

I presume that you have not declared the controllerMap proprty in main configuration file.

In our case, when we are calling,


"example.com/admin/test"

as we have admin as a module, it is going to look for TestController inside the controllers folder of the

admin module for action index.That is why it throws the error.

Then it is appropriate to call


"example.com/admin/admin/test"

If you still want admin/test to point to admin/admin/test,

we can add a rule like this.




'urlManager'=>array(

			'urlFormat'=>'path',

			'showScriptName'=>true,

			'rules'=>array(

				

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


................................................................



Regards.

Solved…

Thanks seenivasan, :)

it was very helpful for me