My CodeIgniter web application must be divided in three big parts:
- Admin – unlimited access to editing, deleting and creating data
- User – read-only
- Partner – limited access to editing data, no deleting, no creating
All parts are independent from each other, but work with the same database.
My question is – what is the best way to keep them apart?
I see two possible ways:
- Subfolder in controller directory. Not good – if i create an Admin-subfolder i wont be able to do something like this admin/events/controller_name.php or admin/places/controller_name.php. And without such a separation it will be a mess.
- Separate applications on subdomains (admin.sitename.com/ , partner.sitename.com/). Also not very good – i will have to duplicate all models (which are same in all cases), libraries etc.
Are there any better ways to do this? It would be really nice if i could somehow use different sets of controllers and only one set of models/libraries.
Separate controller libraries for each.
Read here: http://philsturgeon.co.uk/blog/2010/02/CodeIgniter-Base-Classes-Keeping-it-DRY
Separate folders in Controllers and Views to keep the functionality separate. Use your routing to sort how you reach each.