![]() |
A problem with routing (multiple wildcards?) - 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: A problem with routing (multiple wildcards?) (/showthread.php?tid=2743) |
A problem with routing (multiple wildcards?) - El Forum - 08-22-2007 [eluser]#1313[/eluser] Hello everybody, another newbie coming up! My site has a cars catalogue, and i want to produce following URIs for my cars: Code: http://site.com/cars/lamborgini Code: http://site.com/cars/lamborgini/murcielago I have following functions in my Cars controller, car_maker() and car_model(), and a simple rule in routes.php: Code: $route['cars/:any'] = "cars/car_maker"; But now i want to read a page about Lamborgini Murcielado. I want to add a routing rule to launch car_model function, but i don't know how to write a rule with multiple wildcard characters properly. I tried Code: $route['cars/:any/:any'] = "cars/car_maker/car_model"; A problem with routing (multiple wildcards?) - El Forum - 08-22-2007 [eluser]#1313[/eluser] Whoops, i solved this question by myself =) Code: $route['cars/([a-z_\-]+)/(.+)'] = "cars/car_model/$1/$2"; Worked perfectly. |