6.3. Creating a Rudimentary Admin Framework
One of the great things about CodeIgniter controllers is that they can be organized into folders. This adds only one more URI segment to your activity but keeps related controllers together. In the following sections, you build out some administrative controllers related to orders, products, categories, and admin users, all of which reside in a folder called admin.
This way, once a user logs in, he will be directed to work in the admin/products controller or the admin/categories controller (depending on his task), and each set of controller tasks can be kept separate and organized.
The best thing about this arrangement is that you can continue to work with the same models as before, extending them as needed (although you'll find that many of the models you wrote for the public side of the site are just as useful in the admin context).
The first step in working up a series of admin controllers is to organize your work into folders and controllers, followed by thinking about an administrative framework you can employ. This framework needs to be fairly secure and should involve a new model and database table (for users) and a login form and verification process that sets some kind of global variable needed to access the admin controllers and views.
Before you get too involved with all that, it's time to organize your admin controllers.
6.3.1. Using Folders to Organize Controllers
When you're building a more complex series of interrelated ...
Get Professional CodeIgniter® now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.