/** * Render Template * * This method will output the rendered template content * * @param string $template The path to the template, relative to the templates directory. * @param null $data * @return string */ protected function render($template, array $data = array()) { if ('php' == pathinfo($template, PATHINFO_EXTENSION)) { return parent::render($template, $data); } $parser = $this->getInstance(); $parser->assign($this->all()); return $parser->fetch($template, $data); }
/** * Render Twig Template * * This method will output the rendered template content * * @param string $template The path to the Twig template, relative to the Twig templates directory. * @param null $data * @return string */ public function render($template, array $data = array()) { if ('php' == pathinfo($template, PATHINFO_EXTENSION)) { return parent::render($template, $data); } $env = $this->getInstance(); $parser = $env->loadTemplate($template); $data = array_merge($this->all(), (array) $data); return $parser->render($data); }