Professional CodeIgniter

(singke) #1

Chapter 8: Last-Minute Upgrades


245


< h1 > < ?php echo $title;? > < /h1 >

< ?php
echo form_open(‘admin/pages/create’);
echo “ < p > < label for=’pname’ > Name < /label > < br/ > ”;
$data = array(‘name’= > ’name’,’id’= > ’pname’,’size’= > 25);
echo form_input($data) .” < /p > ”;

echo “ < p > < label for=’short’ > Keywords < /label > < br/ > ”;
$data = array(‘name’= > ’keywords’,’id’= > ’short’,’size’= > 40);
echo form_input($data) .” < /p > ”;

echo “ < p > < label for=’desc’ > Description < /label > < br/ > ”;
$data = array(‘name’= > ’description’,’id’= > ’desc’,’size’= > 40);
echo form_input($data) .” < /p > ”;

echo “ < p > < label for=’fpath’ > Path/FURL < /label > < br/ > ”;
$data = array(‘name’= > ’path’,’id’= > ’fpath’,’size’= > 50);
echo form_input($data) .” < /p > ”;

echo “ < p > < label for=’long’ > Content < /label > < br/ > ”;
$data = array(‘name’= > ’content’,’id’= > ’long’,’rows’= > 5, ‘cols’= > ’40’);
echo form_textarea($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 page’);
echo form_close();
? >

Please note the use of FURL in this context. It ’ s shorthand for “ friendly URL. ” A friendly URL means
different things to different people, but at the end of the day, what you want is something that is easy to
remember and type (hence “ friendly ” ). For example, http://www.example.com/about is much friendlier than
http://www.example.com/page/3 or http://www.example.com/page.php?id=3 (the last example isn ’ t typical of
CodeIgniter, by the way).

Your admin_pages_create view should look like Figure 8 - 2 when you ’ re done.

Free download pdf