CodeIgniter Forums
complex routing with nested url - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: complex routing with nested url (/showthread.php?tid=50499)



complex routing with nested url - El Forum - 03-28-2012

[eluser]Unknown[/eluser]
I have a question about how to set up my routing for an application i am building.

I have a few normal controllers which work:

Code:
/users
/pages
/etc

Now i want to make a somewhat nested structure in my application

Code:
/brand
/brand/project
/brand/project/folder

each of these steps should have its own controller where certain methodes can be called like:

Code:
/brand/project/add (load project controller)
/brand/project/edit/12 (load project controller)
/brand/project/folder/delete/56 (load folder controller)

However i have no idea how to make this work with the routes.php function.

I tried this, however this was for the following url structure

Code:
/brands/1/projects/1375/folders

Code:
$route['brands/(:num)/projects/(:num)/folders'] = "folders";
$route['brands/(:num)/projects/(:num)'] = "folders";
$route['brands/(:num)/projects'] = "projects";
$route['brands/(:num)'] = "projects";
$route['brands'] = "brands";

But i couldnt call for example an add function in the projects controller.

Can anyone give me a kick in the right direction?