Professional CodeIgniter

(singke) #1

Chapter 8: Last-Minute Upgrades


256


< h1 > < ?php echo $title;? > < /h1 >
< p > < ?php echo anchor(“admin/subscribers/sendemail”, “Create new email”);? > < /p >
< ?php
if ($this- > session- > flashdata(‘message’)){
echo “ < div class=’message’ > ”.$this- > session- > flashdata(‘message’).” < /div > ”;
}

if (count($subscribers)){
echo “ < table border=’1’ cellspacing=’0’ cellpadding=’3’ width=’400’ > \n”;
echo “ < tr valign=’top’ > \n”;
echo “ < th > ID < /th > \n < th > Name < /th > < th > Email < /th > < th > Actions < /th > \n”;
echo “ < /tr > \n”;
foreach ($subscribers as $key = > $list){
echo “ < tr valign=’top’ > \n”;
echo “ < td > ”.$list[‘id’].” < /td > \n”;
echo “ < td > ”.$list[‘name’].” < /td > \n”;
echo “ < td > ”.$list[‘email’].” < /td > \n”;
echo “ < td align=’center’ > ”;
echo anchor(‘admin/pages/delete/’.$list[‘id’],’unsubscribe’);
echo “ < /td > \n”;
echo “ < /tr > \n”;
}
echo “ < /table > ”;
}
? >

Updating Navigation in Views


Before you return to the controller function called sendmail() , it ’ s worth your time to update the
admin_home and admin_header views to include links to your new controller.

Here ’ s the update in admin_home (in bold):

< ul >

...


< br/ >
< li > < b > < ?php echo anchor(“admin/subscribers/”,”Manage Subscribers”);? >. < /b >
< br/ >
Manage subscribers and send out emails.
< /li >

< li > < b > < ?php echo anchor(“admin/admins/”,”Manage Users”);? >. < /b >
< br/ >
Create, edit, delete and manage users who can access this dashboard.
< /li >
< br/ >

< li > < b > < ?php echo anchor(“admin/dashboard/logout/”,”Logout”);? >. < /b >
< br/ >
Exit this dashboard when you’re done.
< /li >
< br/ >
< /ul >
Free download pdf