Welcome Guest, Not a member yet? Register   Sign In
Routing example in user guide doesn't work?
#1

[eluser]CI NC[/eluser]
I've been trying using routes for the first time, I just wanted an alias for a controller, so used the example given in the user guide which claims to do that:

Quote:
Code:
$route['journals'] = "blogs";
Any URL containing the word "journals" in the first segment will be remapped to the "blogs" class.

I understood this would give the routing:
journals/index --> blogs/index
journals/add --> blogs/add

etc.

But -- this doesn't seem to work. Looking at libraries/Router.php, the regex that processes wild cards has a ^ at the beginning and $ at the end, to only match URLS which match exactly.

It looks like there should be another case without the $ at the end.

At the moment, the only way I could make it work was by using backreferences in the routing array:

Code:
$route['journals/(.*)'] = "blogs/$1";

Can anyone else confirm this, or have I misunderstood the user guide?


Messages In This Thread
Routing example in user guide doesn't work? - by El Forum - 09-03-2007, 08:20 AM
Routing example in user guide doesn't work? - by El Forum - 09-03-2007, 09:13 AM
Routing example in user guide doesn't work? - by El Forum - 09-03-2007, 09:24 AM
Routing example in user guide doesn't work? - by El Forum - 09-03-2007, 09:27 AM
Routing example in user guide doesn't work? - by El Forum - 09-03-2007, 09:51 AM
Routing example in user guide doesn't work? - by El Forum - 09-03-2007, 09:53 AM
Routing example in user guide doesn't work? - by El Forum - 09-03-2007, 12:00 PM
Routing example in user guide doesn't work? - by El Forum - 09-04-2007, 07:19 AM



Theme © iAndrew 2016 - Forum software by © MyBB