Welcome Guest, Not a member yet? Register   Sign In
Need help for routing
#1

[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
#2

[eluser]CodeIgniteMe[/eluser]
put
$route[‘Products/(:any)/(:any)’] = ‘product/subcategory/$2’;
before
$route[‘Products/(:any)’] = ‘product/category/$1’;
#3

[eluser]lamhuy300890[/eluser]
@CodeIgniteMe: great, thanks.
#4

[eluser]CodeIgniteMe[/eluser]
No problem.




Theme © iAndrew 2016 - Forum software by © MyBB