Multiple sub categories |
[eluser]NateL[/eluser]
I'm laying out my application right now and am a bit puzzled about how I am going to manage categories, sub categories, and sub-sub categories. It will work a bit like this: (for example)...a web page selling different animals example.com/available ---> displays categories for different types of animals (dogs and cats) example.com/available/cats ---> displays all available cats, plus sub categories to narrow the cats by breed example.com/available/cats/bengal ---> displays all bengal cats. Now an option to search male/female example.com/available/cats/bengal/male ----> displays all male bengal cats for sale. the categories Cats and Bengal are completely dynamically controlled. The administrator will put in different types of animals and animal breeds in the database, so how would I write my controller to understand that? Beyond that, the admin section: example.com/available/admin example.com/available/admin/addAnimal example.com/available/admin/addBreed etc. Am I most likely going to be able to accomplish this using Matchbox? Thanks
[eluser]Hazlitt[/eluser]
Here is a way that it could be done. Get your model to return the sub categories (eg. cat) from the database. Build the url in your 'available'controller and pass it to the view to be displayed. Use the $this->uri->segment(n) function to identify whether segments 2 and 3 of the url exist and what they are and use this information to requery the database. You may find the following helpful : http://ellislab.com/codeigniter/user-gui...s/uri.html |
Welcome Guest, Not a member yet? Register Sign In |