Jaggi
(Jaggi 2005)
October 22, 2012, 1:20pm
1
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.
ravi
(Raviverma 5688)
October 22, 2012, 1:33pm
2
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,
zaccaria
(Matteo Falsitta)
October 22, 2012, 1:33pm
3
You can make another submodule called area with the contollers you need.
Jaggi
(Jaggi 2005)
October 22, 2012, 2:33pm
4
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,
I can swear I’d tried that, thanks it’s working now.