/** * 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; }
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; }