示例#1
0
<div class="row">
    <div class="col-md-8">
        <form action="<?php 
echo URL::base();
echo Request::current()->uri();
?>
" method="post" class="form-horizontal" enctype="multipart/form-data"> 
            <div class="panel panel-default">
                <div class="panel-body">
                    <div class="form-horizontal">
                        <?php 
foreach ($options as $field => $attributes) {
    ?>
                            <div class="form-group">
                                <?php 
    echo FORM::form_tag($field, $attributes, isset($data[$field]) ? $data[$field] : NULL);
    ?>
                            </div>
                        <?php 
}
?>
                        <div class="form-group">
                            <div class="col-sm-offset-5 col-sm-7">
                                <?php 
echo FORM::button('submit', __('Update'), array('type' => 'submit', 'class' => 'btn btn-primary'));
?>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
示例#2
0
 /**
  * renders the form view to fill the data and then saves it
  * @return string html
  */
 public function form()
 {
     //for each field reder html_tag
     $tags = array();
     foreach ($this->fields as $name => $options) {
         $value = isset($this->data[$name]) ? $this->data[$name] : NULL;
         $tags[] = FORM::form_tag($name, $options, $value);
     }
     //render view
     return View::factory('oc-panel/pages/widgets/form_widget', array('widget' => $this, 'tags' => $tags));
 }