示例#1
0
 public function render()
 {
     if ($this->format == 'json') {
         $errors = get_error_array();
         if (is_array($errors)) {
             if (isset($this->json['errors'])) {
                 $this->json['errors'] = array_merge($this->json['errors'], $errors);
             } else {
                 $this->json['errors'] = $errors;
             }
         }
         $this->render_json();
     } else {
         $file = $this->app_root . "/" . class_to_underscore(get_class($this)) . "/views/" . $this->view . ".php";
         if (file_exists($file)) {
             foreach (get_object_vars($this) as $var => $val) {
                 ${$var} = $val;
             }
             if ($this->is_page) {
                 if (!method_exists($menu, 'run')) {
                     require_once $this->app_root . '/menu/menu.php';
                     $menu = new Menu();
                 }
                 if (isset($token)) {
                     $token = $this->get_csrf_token();
                 }
                 include $this->app_root . "/home/views/open.php";
                 include $file;
                 include $this->app_root . "/home/views/close.php";
             } else {
                 include $file;
             }
         }
         render_errors_js();
     }
 }
示例#2
0
      </div>
   </div>
   <? render_errors_js() ?>
</body>
</html>