コード例 #1
0
ファイル: controller.php プロジェクト: byyeong/dc2016
 public function render()
 {
     include_once '../tf_app/template_/Template_.class.php';
     if ($this->tpl_name) {
         $tpl = new Template_();
         if (substr($this->tpl_name, 0, 2) == "//") {
             $tpl_location = "views" . substr($this->tpl_name, 1);
         } else {
             if ($this->_trail->_use_component) {
                 $tpl_location = "ext/" . $this->tpl_name;
             } else {
                 if (substr($this->tpl_name, 0, 1) == "/") {
                     $tpl_location = "views" . $this->tpl_name;
                 } else {
                     $tpl_location = "views/" . $this->_class_name . '/' . $this->tpl_name;
                 }
             }
         }
         $tpl->define('body', $tpl_location . ".tpl");
         $this->assigns["settings"] = $this->settings;
         $this->assigns["tpl_name"] = $this->tpl_name;
         $tpl->assign($this->assigns);
         $tpl->define($this->defines);
     }
     if ($this->layout) {
         $layout = new Template_();
         if (substr($this->layout, 0, 2) == "//") {
             $tpl_location = "views" . substr($this->layout, 1);
         } else {
             if ($this->_trail->_use_component) {
                 $tpl_location = "ext/" . $this->layout;
             } else {
                 if (substr($this->layout, 0, 1) == "/") {
                     $tpl_location = "views" . $this->layout;
                 } else {
                     $tpl_location = 'views/layouts/' . $this->layout;
                 }
             }
         }
         $layout->define('layout', $tpl_location . '.tpl');
         $this->assigns_layout["contents_for_layout"] = $tpl->fetch('body');
         $this->assigns_layout["settings"] = $this->settings;
         $layout->assign($this->assigns_layout);
         $layout->define($this->defines_layout);
         $layout->print_('layout');
     } else {
         if ($this->tpl_name) {
             $tpl->print_('body');
         }
     }
 }