Reputation: 2220
I am planning to develop a portal separated into modules using codeigniter's third party HMVC. One such module is "Classifieds".
I was thinking of the following structure:
www.site.com/classifieds/2-a-category-name/32-a-listing-title
This will list the details of the particular listing ID 32 which belongs to category ID 2
www.site.com/classifieds/4-a-category-name
This will list all the listings in the category ID 4
www.site.com/classifieds/add/listing, www.site.com/classifieds/edit/listing/4, www.site.com/classifieds/delete/category/5
This will add/edit/delete listings and categories.
Now I am confused as to what controllers I should be using? Is it OK to have "Add", "Edit", "Delete" controllers? and use the main "classifieds" controller to display the pages according to the URI segments?
Upvotes: 0
Views: 346
Reputation: 3794
Your URLs should be something like:
www.site.com/classifieds/listing/add
www.site.com/classifieds/listing/edit
www.site.com/classifieds/listing/delete
www.site.com/classifieds/category/add
With HMVC you can have structures like
classified
controllers
classified.php
category.php
listing.php
so for www.site.com/classifieds/listing/add
you would add a method add()
to the listing controller in the classified module
Upvotes: 1