CodeIgniter Forums
User Guide: Routing - 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: User Guide: Routing (/showthread.php?tid=6286)



User Guide: Routing - El Forum - 02-21-2008

[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?


User Guide: Routing - El Forum - 02-21-2008

[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?


User Guide: Routing - El Forum - 02-21-2008

[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.