Professional CodeIgniter

(singke) #1

Chapter 6: Creating a Dashboard


160


Figure 6-4

Now when an admin logs out, he or she should see an error message similar to the one pictured in
Figure 6 - 4.

That ’ s one bit of work that is out of the way. Now you can concentrate on the other parts of the admin tool.

Creating the Category Management Tools


In this section, you create all the pages that Claudia needs to manage categories. This involves adding
some new functions to the admin/categories controller, adding a handful of functions to the existing
MCats model, and creating three new views.

Creating the Home Page of the Admin Panel


The first step is creating the Category home page. In the admin/categories controller, create an index()
function:

function index(){
$data[‘title’] = “Manage Categories”;
$data[‘main’] = ‘admin_cat_home’;
$data[‘categories’] = $this- > MCats- > getAllCategories();
$this- > load- > vars($data);
$this- > load- > view(‘dashboard’);
}
Free download pdf