Valor_
Valor_

Reputation: 3591

Right way routing urls in Codeigniter

I want to know what is the right way to do routes in codeigniter. So far first and second routh work perfect, but when i want to add last one, code doesn't work.

Controller store shows categorys. When i click on one category, let sey mens-were, it show all sub-categorys and so on and on. But last routh doesn't work for me, because second route allready gets called. So there must be some sort of work-around!

$route['store/mens-were'] = "store/show_subcategorys";
$route['store/menswear/(:any)'] = "store/show_products_in_subcategory";
$route['store/menswear/mens-jackets/(:any)'] = "store/show_product";

Can enybody help?

tnx!

Upvotes: 0

Views: 58

Answers (1)

Suthan Bala
Suthan Bala

Reputation: 3299

You need to place them in the right order. In your case, it should be:

$route['store/mens-were'] = "store/show_subcategorys"; $route['store/menswear/mens-jackets/(:any)'] = "store/show_product"; $route['store/menswear/(:any)'] = "store/show_products_in_subcategory";

Upvotes: 2

Related Questions