Sub Directory In Controllers Folder

Hi,

I’m trying to overcome the following issue:

I have a submodule at the following path:

/admin/dashboard

and within the dashboard module I’m trying to create the following structure:

/admin/dashboard/area/<controller>/<action>

(area being a directory in the controllers folder)

Could someone say if this is possible. I’ve tried fiddling with the url rules and added the directory to the include path but not been successful.

Hi - Just create controller under "dashboard" sub module and you can manage the URLs in config/main.php file. Below is an example to manage the URL:




'urlManager'=>array(

			'urlFormat'=>'path',

			'rules'=>array(

        		array('admin/dashboard/abc/view', 'pattern'=>'admin/dashboard/area/abc/view', 'verb'=>'GET'),

));



You can skip the “verb” in above code, I’m using it for REST API.

Above code will call your "view" function of "abc" controller of Dashboard sub-module whenever you will try to access "admin/dashboard/area/abc/view" url.

You can even write common url rule for all the controllers of "dashboard sub-module" to add "area" word in URL, just have a look on below url:

http://www.yiiframew…1/en/topics.url

Thanks,

You can make another submodule called area with the contollers you need.

I can swear I’d tried that, thanks it’s working now.