Beispiel #1
0
 public function render()
 {
     try {
         $template = '';
         if ($this->template != '') {
             ob_start();
             include APP_ROOT . 'pages' . DS . 'template' . DS . $this->template;
             $template .= ob_get_clean();
         }
         if (!empty($this->childs)) {
             foreach ($this->childs as $child) {
                 $childTemplate = $child->render();
                 $mark = strpos($template, '[?' . $child->getName() . '?]');
                 if ($mark == false) {
                     $template .= $childTemplate;
                 } else {
                     $template = str_replace('[?' . $child->getName() . '?]', $childTemplate, $template);
                 }
             }
         }
         if ($this->wrapper != '') {
             $wrapper = new Wrapper($this->wrapper, $template);
             $template = $wrapper->render();
         }
         return $template;
     } catch (Exception $e) {
         echo $e->getMessage(), "\n";
     }
 }