04-07-2017, 03:46 PM
I have this scenario:
One controller called Brands with relative class Brands.
Inside this controller the following functions:
index() - This is showing the list of all brands inside my db
show($slug) - This is showing the detail of the brand clicked and all list of the products related with that brand.
detail($slug) - This is showing the detail of one product belonging to the previous product list
When I call index, as normal, I have a url like that:
- http://localhost/brands
When I click on a brand of this list, I have an url like that:
- http://localhost/brands/show/apple
When I click on a product of this list, I have an url like that:
- http://localhost/brands/detail/macbook-13-retina
I would like to have previous urls in this form:
- http://localhost/brands
- http://localhost/brands/apple
- http://localhost/brands/apple/macbook-13-retina
Now, I've read a lot of tutorials and I've read how to routing library works, but
I can't understand if routes can help me more than a htaccess.
Also, the cms I'm building can be installed with a different language than English, so I can have
for example:
- http://localhost/brands but as well
- http://localhost/marcas or
- http://localhost/marche
How can I use routing or htaccess for to get the above changes?
Can someone help me? Thank you very much in advance...
Giorgio
One controller called Brands with relative class Brands.
Inside this controller the following functions:
index() - This is showing the list of all brands inside my db
show($slug) - This is showing the detail of the brand clicked and all list of the products related with that brand.
detail($slug) - This is showing the detail of one product belonging to the previous product list
When I call index, as normal, I have a url like that:
- http://localhost/brands
When I click on a brand of this list, I have an url like that:
- http://localhost/brands/show/apple
When I click on a product of this list, I have an url like that:
- http://localhost/brands/detail/macbook-13-retina
I would like to have previous urls in this form:
- http://localhost/brands
- http://localhost/brands/apple
- http://localhost/brands/apple/macbook-13-retina
Now, I've read a lot of tutorials and I've read how to routing library works, but
I can't understand if routes can help me more than a htaccess.
Also, the cms I'm building can be installed with a different language than English, so I can have
for example:
- http://localhost/brands but as well
- http://localhost/marcas or
- http://localhost/marche
How can I use routing or htaccess for to get the above changes?
Can someone help me? Thank you very much in advance...
Giorgio