Suggestion: Easier Way to Manage Routes - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Suggestion: Easier Way to Manage Routes (/showthread.php?tid=41543) |
Suggestion: Easier Way to Manage Routes - El Forum - 05-10-2011 [eluser]ShoeLace1291[/eluser] I think for the next version of CodeIgniter should include an easier way to manage URI Routes. For example, I think it should be easier to organize your routes by controllers and controller directories, rather than just a huge route array. Here's an example of what I think the route array should look like: Code: //Example of a controller sub directory In a single line, a route for the uri 'forums/boards/Board_Name/123' would look something like this: Code: $route['forums']['boards']['([a-z]+)/(:num)'] = 'forums/boards/view/$1/$2'; The array for controllers that aren't in a subdirectory would have to be defined before the ones that are in a subdirectory. Otherwise, PHP would replace the subdirectory array with the main directory array. I just think something like this might make it alot easier to manage URI routes. Any thoughts? |