Need help for 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: Need help for routing (/showthread.php?tid=50483) |
Need help for routing - El Forum - 03-27-2012 [eluser]lamhuy300890[/eluser] Hi, My site have many categories: shoes, clothing ... and sub categories: clothing |--- T-shirt |--- Shirt .... I want to route my URL like: mysite/clothing : show all products in clothing category. mysite/clothing/shirt : show products in shirt sub category. mysite/clothing/shirt/product1 : show detail for product1. My routes file like this: $route['Products/(:any)'] = 'product/category/$1'; $route['Products/(:any)/(:any)'] = 'product/subcategory/$2'; The first route for category is ok, but the second route for sub category doesn't work. How can i solve it? Thanks Need help for routing - El Forum - 03-28-2012 [eluser]CodeIgniteMe[/eluser] put $route[‘Products/(:any)/(:any)’] = ‘product/subcategory/$2’; before $route[‘Products/(:any)’] = ‘product/category/$1’; Need help for routing - El Forum - 03-28-2012 [eluser]lamhuy300890[/eluser] @CodeIgniteMe: great, thanks. Need help for routing - El Forum - 03-28-2012 [eluser]CodeIgniteMe[/eluser] No problem. |