Welcome Guest, Not a member yet? Register   Sign In
Using (:any) in routes
#1

[eluser]mddd[/eluser]
Because of this thread I found that (:any) behaves differently then I expected. And maybe differently then other people might expect.

Normally, routes have to match exactly: $route['method/controller'] will NOT match "method/controller/123".
Also, $route['method/controller/(:num)'] WILL match "method/controller/123" but NOT "method/controller/123/456".

On the other hand, $route['method/controller/(:any)'] will match "method/controller/test" but ALSO "method/controller/test/another-test".

From reading the manual, it seems that (:any) is meant to match any segment. But in reality, it matches any segment or multiple segments. This caused the problem for the topic starter in the thread mentioned before.

It seems to me that :any should really be translated into [^/]+ and not .+. Although I realize it breaks previous behaviour.
What do you think?


Messages In This Thread
Using (:any) in routes - by El Forum - 05-31-2010, 02:22 AM
Using (:any) in routes - by El Forum - 05-31-2010, 02:31 PM
Using (:any) in routes - by El Forum - 06-01-2010, 12:33 AM
Using (:any) in routes - by El Forum - 08-09-2010, 07:50 PM
Using (:any) in routes - by El Forum - 08-09-2010, 07:55 PM



Theme © iAndrew 2016 - Forum software by © MyBB