![]() |
HELP - Using Routes.php to turn all paths into parameters. - 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: HELP - Using Routes.php to turn all paths into parameters. (/showthread.php?tid=12655) |
HELP - Using Routes.php to turn all paths into parameters. - El Forum - 10-27-2008 [eluser]orokusaki[/eluser] Hi, so what I'm trying to do is bypass all controller / function segments in the URL so that I can have: http://site.com/param1/param2/param3 ... and so on I have: Code: $route[':any'] = "controller_1/function_1"; and it works fine... except: If have another controller controller_2, and I go to http://site.com/controller_2/ it accesses controller_1 and sets the param1 as "controller_2" instead of accessing controller_2 How do I use all segments of the URI as params for a single function, with a condition that if the first segment is a controller it uses that controller instead of passing it as a param? P.S. I am setting the custom route after the reserved routes. HELP - Using Routes.php to turn all paths into parameters. - El Forum - 10-27-2008 [eluser]Jelmer[/eluser] You should declare a route for every url other than those for the wildcard before the wildcard rule (:any). like this: Code: $route['controller_2'] = "controller_2"; HELP - Using Routes.php to turn all paths into parameters. - El Forum - 10-27-2008 [eluser]orokusaki[/eluser] Awesome thanks. I didn't think anything like that would work. Will try it tonight. |