Url params in 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: Url params in routes (/showthread.php?tid=9951) |
Url params in routes - El Forum - 07-14-2008 [eluser]louis w[/eluser] I have the following route set up: Code: $route['XML/foo(.*)'] = "foo$1?format=xml"; The route works, but errors. It seems like the re-routed uri becomes /foo/bar?format=xml/ Notice the trailing slash. Is there a way to have url params work in routes? Thanks. Url params in routes - El Forum - 07-14-2008 [eluser]Colin Williams[/eluser] Hrm... that's not going to work like you think it is. By routing like that, you aren't magically creating a query string, your just telling CI to store the URI in a slightly different manner. And it's not CI that parses the URI for a query string, it's PHP (or, CGI, maybe). PHP won't know about this routing. You would have to parse the re-routed URI yourself. Url params in routes - El Forum - 07-14-2008 [eluser]louis w[/eluser] Hmm, yea I see what you are saying. I guess I thought that CI would parse the string and take out params. For the time being I just used $this->uri->segment(n) to get the first segment. Thanks. Url params in routes - El Forum - 07-14-2008 [eluser]Colin Williams[/eluser] Sure thing. |