Outputs a view file/template.

@param string $templateName
@param array  $data

@throws \Exception

@return View
772314
protected function view(string $templateName, array $data = [])
    {
        $view = new View($this->container(TemplateEngine::class));
        $view->setData($data);
        $view->setTemplateName($templateName);

        return $view;
    }
20290
public function render($name, array $data = [])
    {
        
        //$templatePath = $this->manager->pathByName($name);
        $template = $this->twig->load($name);
        return $template->render($data);
    }
559235
public function htmlTemplate($template, $data=[]) {
		$data['message'] = $this;
		$res = $this->buildTemplate($template, $data);
		return $this->html($res);
	}
1136134
public function view($template, $data = [], $mergeData = [])
    {
        $template = get_instance()->templateEngine->render($template, $data, $mergeData);
        return $template;
    }
107537
public static function getView($viewName, $data = null, $templateRootFolder = null)
    {
        $view = new \erdiko\core\View($viewName, $data);

        if ($templateRootFolder !== null) {
            $view->setTemplateRootFolder($templateRootFolder);
        }
        return  $view->toHtml();
    }
1300258
public function createEmailTemplate(array $templateData)
    {
        if ($this->findEmailTemplate($templateData)) {
            throw new Exception("Email template for event {$templateData['EVENT_NAME']} already exists");
        }

        $et = new CEventMessage;
        $res = $et->add($templateData);
        if (!$res) {
            throw new Exception("Can't create email event type {$templateData['EVENT_NAME']}: {$et->LAST_ERROR}");
        }

        return ["Email template({$res}) for event {$templateData['EVENT_NAME']} created"];
    }
1290076
public function getLayout($layoutName, $data = null, $templateRootFolder = null)
    {
        $layout = new \erdiko\core\Layout($layoutName, $data, $this->getThemeName());
        $layout->setTitle($this->getBodyTitle());

        if ($templateRootFolder != null) {
            $layout->setViewRootFolder($templateRootFolder);
            $layout->setTemplateRootFolder($templateRootFolder);
        }

        return  $layout->toHtml();
    }
1283743
public function setTemplate($templateName, $data = [])
    {
        if (!empty($data)) {
            if (is_array($data)) {
                $this->_data = array_merge($this->_data, $data);
            }
        }

        return $this;
    }
261817
public function render(string $template, array $data = [])
    {
        try {
            return $this->load($template)->render($data);
        } catch (SyntaxError $e) {
            if ($this->exceptionHandler) {
                $templatePath = $this->finder->find($template);

                $e->setTemplateFile($templatePath);
                $e->setTemplateContent($this->finder->getContents($templatePath));

                return $this->renderSyntaxError($e);
            } else {
                throw $e;
            }
        }
    }
895146
public function render($fileName, $data = [])
    {
        $content = $this->renderParticle($fileName, $data);
        if ($this->layout) {
            ob_start();
            ob_implicit_flush(false);
            $layout = $this->getLayoutPath();
            require $layout;
            return ob_get_clean();
        } else {
            return $content;
        }
    }
802713
public function render($template, array $data = [])
    {
        ob_start();
        $this->requireTemplate($template, $data);

        while ($extend = array_pop($this->inherits)) {
            ob_clean();
            $this->requireTemplate($extend, $data);
        }

        return ob_get_clean();
    }
186565
public function compile($template, $data = array())
    {
        $compiler = new BladeCompiler($this->files, 'theme');

        // Get blade compiler.
        $parsed = $compiler->compileString($template);

        ob_start() and extract($data, EXTR_SKIP);
        try {
            eval('?>'.$parsed);
        } catch (\Exception $e) {
            ob_end_clean(); throw $e;
        }
        $template = ob_get_contents();
        ob_end_clean();

        return $template;
    }
1280854
public function render($templates, array $data = array())
    {
        $templates = (array) $templates;

        foreach ($templates as $template) {
            if (!is_readable($template) || !is_file($template)) {
                throw new \Shade\Exception('Template file "'.$template.'" does not exists');
            }
            $content = str_replace(array_keys($data), $data, file_get_contents($template));
            $data[$this->layoutContentPlaceholder] = $content;
        }

        return $content;
    }
837253
protected function responseTemplate($template, $data = array()){
        
        if(!isset(hubert()->template)){
            throw new \Exception("no template engine installed");
        }
        $html = hubert()->template->render($template, $data);
        $this->_response->getBody()->write($html);
        
        return $this->_response;
        
    }
149627
public function fetch($template, $data = []) {
        if ('' == pathinfo($template, PATHINFO_EXTENSION)) {
            // 获取模板文件名
            $template = $this->parseTemplate($template);
        }
        // 模板不存在 抛出异常
        if (!is_file($template)) {
            throw new \Exception('template not exists:' . $template, $template);
        }
        $this->template = $template;

        extract($data, EXTR_OVERWRITE);
        include $this->template;
    }
41051
protected function view($name, array $data = array())
    {
        $tpl = $this->viewEngine->template($name);
        $tpl->vars->add($data);

        return $tpl->render();
    }
218165
public function javascriptTemplateRender($templateName, $viewData) {
    /** @var $templateEngine \Twig_Environment */
    $templateEngine = $this->getTemplateEnv();
    return $templateEngine->render($templateName, $viewData);
  }