Welcome Guest, Not a member yet? Register   Sign In
User Guide: Routing
#1

[eluser]Unknown[/eluser]
User Guide: Routing

Hmm. It seems that the examples here don't really illustrate how to use the :any/:num wildcard properly. For example:
Code:
$route['product/:any'] = "catalog/product_lookup";
ought to be
Code:
$route['product/(:any)'] = "catalog/product_lookup/$1";

An extra note about bracketing :any and :num like regexps, as well as the $1/$2 convention would help.

I was stuck on this for a while until searching the forum for help. Maybe someone could propose updating the guide to reflect this?
#2

[eluser]Phil Sturgeon[/eluser]
Whats the difference between using brackets and not? You will want to add in $1 of course, but do the brackets change anything?
#3

[eluser]Unknown[/eluser]
It doesn't work for me without enclosing :any in round brackets. The route doesn't seem to get matched.

I'm using CI 1.6.1 if it makes a difference.




Theme © iAndrew 2016 - Forum software by © MyBB