コード例 #1
0
ファイル: BasicTagLib.php プロジェクト: hofmeister/Pimple
 /**
  * include a template file - in the current template (transparently)
  * @param string file | path to the template file - relative from view/
  */
 protected function tagInclude($attrs, $view)
 {
     $include = new View($attrs->file);
     $result = $include->render($view->data);
     $view->data = DataUtil::merge($view->data, $include->data);
     return $result;
 }
コード例 #2
0
ファイル: View.php プロジェクト: hofmeister/Pimple
 public function render($data = array())
 {
     self::addCurrent($this);
     $cachename = $this->getCacheName();
     if ($data instanceof Model) {
         $data = $data->toArray();
     }
     $this->data = DataUtil::merge($this->data, $data);
     $this->parseTemplate();
     ob_start();
     try {
         $this->_include($cachename);
     } catch (Exception $e) {
         //TODO: Handle errors
         echo $e;
     }
     $result = ob_get_clean();
     self::removeCurrent();
     return $result;
 }