Professional CodeIgniter, Thomas Myer
Chapter 8: Last-Minute Upgrades
243
Create, edit, delete and manage colors available to products.
<
/li
>
<
br/
>
<
li
>
<
b
>
<
?php echo anchor("admin/sizes/","Manage Sizes");?
>
.
<
/b
>
<
br/
>
Create, edit, delete and manage sizes available to products.
<
/li
>
<
br/
>
<
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
>
Creating the Home Page View
The admin_pages_home view is very simple. It consists of a link that allows the user to create a new
page, followed by a table that lists every single page in the database. In other words, the table renders
the results of the
getAllPages()
model function invoked in the controller.
<
h1
>
<
?php echo $title;?
>
<
/h1
>
<
p
>
<
?php echo anchor("admin/pages/create", "Create new page");?
>
<
/p
>
<
?php
if ($this-
>
session-
>
flashdata(`message')){
echo "
<
div class='message'
>
".$this-
>
session-
>
flashdata(`message')."
<
/div
>
";
}
if (count($pages)){
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
>
Status
<
/th
>
<
th
>
Actions
<
/th
>
\n";
echo "
<
/tr
>
\n";
foreach ($pages as $key =
>
$list){
echo "
<
tr valign='top'
>
\n";
echo "
<
td
>
".$list[`id']."
<
/td
>
\n";
echo "
<
td
>
".$list[`name']."
<
/td
>
\n";
echo "
<
td align='center'
>
".$list[`status']."
<
/td
>
\n";
echo "
<
td align='center'
>
";
echo anchor(`admin/pages/edit/'.$list[`id'],'edit');
echo " | ";
echo anchor(`admin/pages/delete/'.$list[`id'],'delete');
echo "
<
/td
>
\n";
echo "
<
/tr
>
\n";
}
echo "
<
/table
>
";
}
?
>
c08.indd 243
c08.indd 243
6/10/08 5:37:27 PM
6/10/08 5:37:27 PM