Shortcut for $this->getResponse()->setBody($this->view->fetch($tpl,$data))

@param string $tpl  Name of template
@param array  $data Key=>Value pairs of data for the template
503925
protected function render($tpl, $data = array())
    {
        $content = $this->view->fetch($tpl, $data);
        $resource = fopen('data://text/plain,' . $content,'r');
        $stream = new Stream($resource);
        $this->getResponse()->setBody($stream);
    }
629800
protected function render($tpl)
    {
        $body = new View(
            $tpl,
            get_object_vars($this) + $this->app->locals,
            array('dir' => $this->app->views)
        );

        $this->app->render($this->_tpl_layout, array('body' => $body->render()) + get_object_vars($this));
    }
1176791
function template(tmpl, data) {
  // Grab the template engine
  var engine = settings['template engine'];

  // Process the template through the template engine
  var content = engine.call(this, tmpl, data);

  // Return the content
  return content;
}
553714
public function render(array $data = array())
    {
        parent::render();

        if(!$this->_twig_template instanceof Twig_Template) {
            throw new RuntimeException(sprintf('The template cannot be rendered'));
        }

        //Render the template
        $content = $this->_twig_template->render($data);

        //Remove the template from the stack
        array_pop($this->_stack);

        return $content;
    }
901996
public function display($template, $data = NULL)
    {
        $app = App::getInstance();
        $data = $this->data->all();
        unset($data['flash']);
        unset($data['app']);
        foreach (array_keys($data) as $key) {
            if ($key[0] === '_') {
                unset($data[$key]);
            }
        }

        $app->response->headers['content-type'] = $this->contentType;
        echo \JsonKit\JsonKit::encode($data);
    }
496289
public function display($tpl, $tpl_vars = null) {
        if (!($this->_response instanceof \Swoole\Http\Response)) {
            throw new \Exception(200118);
        }


        $old_value = ini_set('xdebug.cli_color', 0);
        $html = $this->render($tpl, $tpl_vars);
        $this->_response->end($html);
        $old_value === false || ini_set('xdebug.cli_color', $old_value);
        return true;
    }
136374
public function fetch($template, $data = NULL )
    {

        $app = App::getInstance();

        if (empty($template)) {
            return $this->data['body'];
        } else {
            if ($app->theme) {
                $template = $app->theme->resolve($template, $this) ?: $template;
            }

            $html = parent::fetch($template);

            $layoutTemplate = null;
            if ($this->layout) {
                if ($app->theme) {
                    $layoutTemplate = $app->theme->resolve($this->layout, $this->layoutView);
                } else {
                    $layoutTemplate = $this->layout;
                }
            }

            if ($layoutTemplate) {
                $this->layoutView->replace($this->all());
                $this->layoutView->set('body', $html);

                return $this->layoutView->render($layoutTemplate);
            } else {
                return $html;
            }
        }
    }
1171488
public function get($_tpl, $data = array(), $_compiler = null, $_output = false)
    {
        if ($_compiler === null) {
            $_compiler = $this->compiler;
        }

        return parent::get($_tpl, $data, $_compiler, $_output);
    }
246713
protected function resolveBody(TemplateData $data)
    {
        if ($data->getTemplateWrapper()->hasBlock(Constants::BLOCK_EMAIL)) {
            return $data->getTemplateWrapper()
                ->renderBlock(
                    Constants::BLOCK_EMAIL,
                    array(
                        'event' => $data->getEvent(),
                        'collected_fields' => $data->getEvent()->getInformationCollectionStruct()->getCollectedFields(),
                        'content' => $data->getContent(),
                        'default_variables' => !empty($this->config[ConfigurationConstants::DEFAULT_VARIABLES])
                            ? $this->config[ConfigurationConstants::DEFAULT_VARIABLES] : null,
                    )
                );
        }

        throw new MissingEmailBlockException(
            $data->getTemplateWrapper()->getSourceContext()->getName(),
            $data->getTemplateWrapper()->getBlockNames()
        );
    }
193743
public function renderTemplate($tpl, array $render_vars) {
    $registry = new Registry();
    $loader = new \Twig_Loader_Filesystem($registry->templateDirs());
    $twig = new \Twig_Environment($loader, array(
      'cache' => sys_get_temp_dir() . '/drutiny/cache',
      'auto_reload' => TRUE,
    ));
    // $filter = new \Twig_SimpleFilter('filterXssAdmin', [$this, 'filterXssAdmin'], [
    //   'is_safe' => ['html'],
    // ]);
    // $twig->addFilter($filter);
    $template = $twig->load($tpl . '.html.twig');
    $contents = $template->render($render_vars);
    return $contents;
  }
284754
public function fetch($tplname, array $data = [], $merge = true)
    {
        if ($merge) {
            $locals        = $this->vitex->res->locals->all();
            $data          = array_merge($locals, $this->get(), $data);
            $this->tpldata = $data;
        }
        $tplname = $this->style . $tplname;

        $file = $this->template($tplname);
        if (!file_exists($file)) {
            throw new Exception("模板文件--" . $file . '--不存在',Exception::CODE_NOTFOUND_FILE);
        }
        extract($data, EXTR_OVERWRITE);
        ob_start();
        if (file_exists($file)) {
            include $file;
        } else {
            throw new Exception("模板文件：" . $file . "不存在",Exception::CODE_NOTFOUND_FILE);
        }
        return ob_get_clean();
    }
281421
public function onKernelView(GetResponseForControllerResultEvent $event)
    {
        /* @var Template $template */
        $request = $event->getRequest();
        $template = $request->attributes->get('_template');

        if (!$template instanceof Template) {
            return;
        }

        if (null === $this->twig) {
            throw new \LogicException('You can not use the "@Template" annotation if the Twig Bundle is not available.');
        }

        $parameters = $event->getControllerResult();
        $owner = $template->getOwner();
        list($controller, $action) = $owner;

        // when the annotation declares no default vars and the action returns
        // null, all action method arguments are used as default vars
        if (null === $parameters) {
            $parameters = $this->resolveDefaultParameters($request, $template, $controller, $action);
        }

        // attempt to render the actual response
        if ($template->isStreamable()) {
            $callback = function () use ($template, $parameters) {
                $this->twig->display($template->getTemplate(), $parameters);
            };

            $event->setResponse(new StreamedResponse($callback));
        } else {
            $event->setResponse(new Response($this->twig->render($template->getTemplate(), $parameters)));
        }

        // make sure the owner (controller+dependencies) is not cached or stored elsewhere
        $template->setOwner([]);
    }
84277
public function renderTemplate($tpl, array $render) {
    $registry = new \Drutiny\Registry();
    $loader = new \Twig_Loader_Filesystem($registry->templateDirs());
    $twig = new \Twig_Environment($loader, array(
      'cache' => sys_get_temp_dir() . '/drutiny/cache',
      'auto_reload' => TRUE,
      // 'debug' => true,
    ));
    // $twig->addExtension(new \Twig_Extension_Debug());

    // Filter to sort arrays by a property.
    $twig->addFilter(new \Twig_SimpleFilter('psort', function (array $array, array $args = []) {
        $property = reset($args);

        usort($array, function ($a, $b) use ($property) {
          if ($a[$property] == $b[$property]) {
            return 0;
          }
          $index = [$a[$property], $b[$property]];
          sort($index);
          return $index[0] == $a[$property] ? 1 : -1;
        });

        return $array;
    },
    ['is_variadic' => true]));

    $template = $twig->load($tpl . '.' . $this->getFormat() . '.twig');
    $contents = $template->render($render);
    return $contents;
  }
950247
protected function render($template, $data = null)
    {
        $twigView = $this->container->view;

        // By making page data a Twig Global, we can access page data in block elements
        // which are loaded by a Twig function
        $twigEnvironment = $twigView->getEnvironment();
        $twigEnvironment->addGlobal('page', $data);
        $twigEnvironment->addGlobal('alert', $this->alert);

        return $twigView->render($this->response, $template);
    }
546238
public function found(array $data): Response
    {
        $view = $data['view'] ?? '';
        $templateVars = $data['vars'] ?? [];
        $this->response->setBody(
            $this->renderer->render($view, $templateVars)
        );
        return $this->response;
    }
797487
public function render($tplname, array $data = [], $merge = false)
    {
        $data = array_merge($this->tpldata, $data);
        echo $this->fetch($tplname, $data, $merge);
    }
439940
protected function display($tpl, $data = [], $auto_set_tpl_dir = true)
    {
        if ($auto_set_tpl_dir) {
            $dir = substr(get_called_class(), 4);
            $dir = str_replace(['Controllers', 'Controller'], '', $dir);
            $dir = str_replace('\\', '/', $dir);
            $dir = str_replace('//', '/', $dir);
            $dir = strtolower(trim($dir, '/'));
            return $this->response->tpl($dir . '/' . $tpl, $data);
        } else {
            return $this->response->tpl($tpl, $data);
        }

    }