Professional CodeIgniter

(singke) #1

Chapter 6: Creating a Dashboard


148


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.

Using Folders to Organize Controllers


When you ’ re building a more complex series of interrelated controllers, it ’ s often a good idea to organize
those controllers into folders. In your case, you want to create an admin subfolder in the /system/
application/controllers folder, as illustrated in Figure 6 - 1.

Figure 6 - 1

In this folder, you ’ ll create several placeholder controllers:

dashboard.php

products.php

categories.php

admins.php

Just make them bare - bones controllers for now. You ’ ll get back to them presently. Remember to use
session_start() in each of them, as you ’ ll be using PHP sessions for authentication when
administrators log in.




Free download pdf