Welcome Guest, Not a member yet? Register   Sign In
I need some help with routing
#1

[eluser]JesseR[/eluser]
I have a url that currently looks like this :

http://www.domain.com/anything/anything_...YCODE.html
http://www.domain.com/anything/ITEMID.html

MY CI file for CATEGORIES is index.php/categories/getCategories/CATEGORYCODE
MY CI file for ITEMS is index.php/categories/getItem/ITEMCODE

My current website that does not use CI uses this link structure.
Can anyone advise how I can setup routing to work with the above
link structure?
#2

[eluser]danmontgomery[/eluser]
There's an example in the user guide explaining almost exactly what you want.

Quote:If you prefer you can use regular expressions to define your routing rules. Any valid regular expression is allowed, as are back-references.

Note: If you use back-references you must use the dollar syntax rather than the double backslash syntax.

A typical RegEx route might look something like this:
$route['products/([a-z]+)/(\d+)'] = "$1/id_$2";

In the above example, a URI similar to products/shirts/123 would instead call the shirts controller class and the id_123 function.

You can also mix and match wildcards with regular expressions.

http://ellislab.com/codeigniter/user-gui...uting.html




Theme © iAndrew 2016 - Forum software by © MyBB