Routes help |
[eluser]PHP Creative[/eluser]
Hi I was wondering if anybody could help me. I have the following url. http://www.test.com/store/dvds/34 store = controller name dvd = category name (hundreds of possible categories so would be hard to create an array) 34 = id of product Basically I can route the first URI (category) to a function inside store called categories doing the following $route[store/(:any)'] = "store/categories/$1"; But can’t re-route the product id to a function called product_info. Tired the following: $route[store/(:any)/(:any)'] = "store/product_info/$1"; I would really appreciate any help. Thanks a million
[eluser]janogarcia[/eluser]
Hi, try this Code: $route['store/:any/(:any)'] = "store/product_info/$1"; Or if you prefer to fetch each segment at controller level, Code: $route['store/:any'] = "store/product_info"; Then, in your controller constructor or in the product_info() method you would fetch each segment as folllows: Code: $product_category = $this->uri->segment(2); |
Welcome Guest, Not a member yet? Register Sign In |