Professional CodeIgniter, Thomas Myer
Chapter 7: Improving the Dashboard
224
Here is the admin_sizes_create view:
<
h1
>
<
?php echo $title;?
>
<
/h1
>
<
?php
echo form_open(`admin/sizes/create');
echo "
<
p
>
<
label for='name'
>
Name
<
/label
>
<
br/
>
";
$data = array(`name'=
>
'name','id'=
>
'name','size'=
>
25);
echo form_input($data) ."
<
/p
>
";
echo "
<
p
>
<
label for='status'
>
Status
<
/label
>
<
br/
>
";
$options = array(`active' =
>
`active', `inactive' =
>
`inactive');
echo form_dropdown(`status',$options) ."
<
/p
>
";
echo form_submit(`submit','create size');
echo form_close();
?
>
And the admin_sizes_edit view:
<
h1
>
<
?php echo $title;?
>
<
/h1
>
<
?php
echo form_open(`admin/sizes/edit');
echo "
<
p
>
<
label for='name'
>
Name
<
/label
>
<
br/
>
";
$data = array(`name'=
>
'name','id'=
>
'name','size'=
>
25, `value'=
>
$size[`name']);
echo form_input($data) ."
<
/p
>
";
echo "
<
p
>
<
label for='status'
>
Status
<
/label
>
<
br/
>
";
$options = array(`active' =
>
`active', `inactive' =
>
`inactive');
echo form_dropdown(`status',$options, $size[`status']) ."
<
/p
>
";
echo form_hidden(`id',$size[`id']);
echo form_submit(`submit','update size');
echo form_close();
?
>
Once you have all the views in place, add a few sizes into the system. When you ' re done, you should
end up with a sizes index that looks somewhat like Figure 7 - 14 .
c07.indd 224
c07.indd 224
6/10/08 5:36:50 PM
6/10/08 5:36:50 PM