Chapter 6: Creating a Dashboard
155
Creating the Login Mechanism
The easiest thing to do right now is to create the admin_header view. All you need is something similar
to the global navigation on the public side (e.g., the horizontal UL list). Each item in the list contains a
link to a different part of the administrative area, plus a link to allow the user to log out.
< div id=’globalnav’ >
< ul >
< li > < ?php echo anchor(“admin/dashboard/index”,”dashboard”);? > < /li >
< li > < ?php echo anchor(“admin/categories/”,”categories”);? > < /li >
< li > < ?php echo anchor(“admin/products/”, “products”);? > < /li >
< li > < ?php echo anchor(“admin/admins/”, “users”);? > < /li >
< li > < ?php echo anchor(“admin/dashboard/logout/”, “logout”);? > < /li >
< /ul >
< /div >
Creating the admin_footer View
The admin_footer subview is even simpler: just a simple copyright notice. If more is needed later, you
can easily update it.
Copyright < ?php echo date(“Y”);? >
Creating the admin.css File
The admin.css file is just a much simpler version of the CSS instructions on the public side of the web
site. You might notice that these CSS instructions create a “ drab ” look and feel. Some people feel that the
admin side should look more like the public side. Others believe that the admin side should look as
different as possible from the public side, so that no one is ever confused as to where he is, and what he ’ s
doing. For the purposes of this book, the latter approach is taken.
There ’ s no need to have a #nav div or any of that category/subcategory navigation. Also, there ’ s no
need for flashy colors or complex div layouts. Grays and blacks are fine here, as are tables for data
display, as you ’ ll have a lot of that.
Here is the entire admin.css file:
body{
background-color:white;
font-family: Arial, Verdana, sans-serif;
margin:0;
padding:0;
}
#wrapper{
width:800px;
margin:10px auto;
padding:10px;
background-color:#fff;
border:2px solid #ccc;
}