Render an HTML template.

@param string $tpl
The name of the .html.tpl template file to load for rendering.
@param array $render_vars
An array of variables to be used within the template by the rendering engine.

@return string
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;
  }
431524
public function template($tpl)
    {
        $extlen = strlen($this->tplext);
        if (substr($tpl, -$extlen) !== $this->tplext) {
            $tpl .= $this->tplext;
        }
        return $this->getTplPath() . DIRECTORY_SEPARATOR . $tpl;
    }
992665
protected function renderOutput(string $template, array $vars = [])
    {
        $tpl = $this->template . '.'. $template;

        if (view()->exists($tpl)) {
            return view($tpl, $vars)->render();
        }

        abort(404, "View named $tpl not exists.");
    }
437254
public function render($tpl, array $data = [], $status = null)
    {
        if ($this->view === null) {
            $this->view = $this->view();
        }
        if ($status !== null) {
            $this->res->setStatus($status)->send();
        }
        $this->view->display($tpl, $data);
    }
1254762
public function render($templateFile, array $vars = [])
    {
        $this->getService('retriever')->setLocalVars($vars);
        return $this->getService('template')->render($templateFile, $vars);
    }
919061
def render(self, template_name, **kw):
        '''
        
        '''
        logger.debug('Rendering template "%s"', template_name)
        vars = self.globs.copy()
        vars.update(kw)
        resolved_name, engine = self.resolve(template_name)
        return engine.render(resolved_name, **vars)
742557
def render(template)
      template.render(config.variables.deep_merge(options[:globals]), strict_variables: true).tap do
        if template.errors&.length&.positive?
          puts template.errors
          raise template.errors.map(&:to_s).join('; ')
        end
      end
    end
885123
public function render($template, $vars = [], $directOutput = false)
    {
        $context = $this->_context;

        if (DIRECTORY_SEPARATOR === '\\' && strpos($template, '\\') !== false) {
            $template = str_replace('\\', '/', $template);
        }

        if (strpos($template, '/') === false) {
            $template = dirname(end($context->templates)) . '/' . $template;
        }

        $template = $template[0] === '@' ? $this->alias->resolve($template) : $template;

        if (isset($this->_files[$template])) {
            list($file, $extension) = $this->_files[$template];
        } else {
            $file = null;
            $extension = null;
            foreach ($this->_engines as $extension => $engine) {
                if (is_file($file = $template . $extension)) {
                    if (PHP_EOL !== "\n") {
                        $realPath = strtr(realpath($file), '\\', '/');
                        if ($file !== $realPath) {
                            trigger_error("File name ($realPath) case mismatch for $file", E_USER_ERROR);
                        }
                    }

                    break;
                }
            }

            if (!$file) {
                throw new FileNotFoundException([
                    '`:template` with `:extensions` extension file was not found',
                    'template' => $template,
                    'extensions' => implode(', or ', array_keys($this->_engines))
                ]);
            }

            $this->_files[$template] = [$file, $extension];
        }

        if (!isset($this->_resolved[$extension])) {
            $engine = $this->_resolved[$extension] = $this->_di->getShared($this->_engines[$extension]);
        } else {
            $engine = $this->_resolved[$extension];
        }

        if (isset($vars['renderer'])) {
            throw new MisuseException('variable `renderer` is reserved for renderer');
        }
        $vars['renderer'] = $this;

        if (isset($vars['di'])) {
            throw new MisuseException('variable `di` is reserved for renderer');
        }
        $vars['di'] = $this->_di;

        $context->templates[] = $template;

        $eventArguments = ['file' => $file, 'vars' => $vars];
        $this->eventsManager->fireEvent('renderer:beforeRender', $this, $eventArguments);

        if ($directOutput) {
            $engine->render($file, $vars);
            $content = null;
        } else {
            ob_start();
            ob_implicit_flush(false);
            $engine->render($file, $vars);
            $content = ob_get_clean();
        }

        $this->eventsManager->fireEvent('renderer:afterRender', $this, $eventArguments);

        array_pop($context->templates);

        return $content;
    }
416270
public function renderTemplate($filename, array $templateDir, array $params = [], array $vars = [])
    {
        $this->addDirPathIntoLoaderIfNotExists($templateDir);
        $render = '';
        try {
            $params['this'] = $this;
            $params = array_merge($params, $vars);

            try {
                $render = $this->twig->render($filename, $params);
            } catch (\Twig_Error_Runtime $e) {
                if($e->getPrevious() instanceof FrontControllerException) {
                    throw $e->getPrevious();
                }

                throw $e;
            }

        } catch (FrontControllerException $fe) {
            throw $fe;
        } catch (\Exception $e) {
            throw new RendererException(
                sprintf('%s in %s.', $e->getMessage(), $filename),
                RendererException::RENDERING_ERROR,
                $e
            );
        }

        return $render;
    }
60544
public function render()
    {
        $template_variables = $this->prepareRender();

        if ($this->configuration->developerMode()) {
            $this->validate(true);
        }

        // Decode/encode turns the full array/object into an array.
        // Just typecasting to an array does not recursively apply it.
        $template_array = json_decode(json_encode($template_variables), true);

        if (!empty($template_variables->template)) {
            return $this->twig->render($template_variables->template, $template_array);
        } else {
            $log_vars = array('%schema' => '');
            if (isset($this->schema_name)) {
                $log_vars['%schema'] = $this->schema_name;
            } elseif (isset($this->schema_path)) {
                $log_vars['%schema'] = $this->schema_path;
            }
            $this->logger->notice('Cannot render: Missing template property in schema %schema.', $log_vars);
        }
    }
657865
public static function showSystemTemplate($tpl)
    {
        $configSubFix = Config::get('html_template_suffix');
        Config::set('html_template_suffix', '');
        echo View::getEngine('html')
            ->setHtmlEngineOptions('templateDir', dirname($tpl) . DIRECTORY_SEPARATOR)
            ->fetch(basename($tpl), false, true, true);
        Config::set('html_template_suffix', $configSubFix);
    }
1025855
function render()
    {
        $Template = $this->getTemplate();
        if ($Template === null)
            // Nothing To Render!!
            return null;

        if (! is_file($Template) )
        {
            ## resolve to template file path from name
            $_t_template = $this->resolver()->resolve($Template);

            ## only if file resolved
            ($_t_template === false) ?: $Template = $_t_template;

            ##! Note:
            ##- if file not resolved let it handle within renderer
            ##- ..
        }

        ## Render Into Variable:
        $vars = \Poirot\Std\cast($this->variables())->toArray();
        $renderer = $this->renderer();

        // !! If Template not resolved also let renderer to resolve into template path.

        ErrorStack::handleError(); // handle errors --------------------\
        #
        if (is_callable($renderer))
            $result = call_user_func($renderer, $Template, $vars);
        else
            ### its renderer instance
            $result = $renderer->capture($Template, $vars);
        #
        if ($ex = ErrorStack::handleDone()) throw $ex; // --------------/


        return $result;
    }
582743
protected function renderBlock($name, $vars)
    {
        if (!$this->template->hasBlock($name)) {
            throw new \RuntimeException('Block "' . $name . '" not found.');
        }
        return $this->template->renderBlock($name, $vars);
    }
242816
public function view($tpl_vars = array(), $tpl_path = null) {
        $view = new \Comm\View($this->_response, $this->_req);
        if(!$tpl_path) {
            $tpl_name = $this->getRequest()->getControllerName();
            $tpl_path = strtolower(str_replace('_', '/', $tpl_name));
        }
        $tpl_path .= '.phtml';
        $view->display($tpl_path, $tpl_vars);
    }
994687
public function display($tpl = null)
    {
        $attributes = array();
        $query = array();

        $app = JFactory::getApplication();
        $input = $app->input;

        $routeName = $input->get('route', null, 'string');
        $path = $input->get('path', null, 'string');

        $route = self::$router->getRouteCollection()->get($routeName);
        $defaults = $route->getDefaults();

        if ($path !== null) {
            $path = rtrim($route->getPath(), '/') . '/' . $path;
            $defaults = self::$router->match($path, null, false);
        }

        unset($attributes['_controller']);

        foreach ($defaults as $key => $default) {
            if (!isset($attributes[$key])) {
                $attributes[$key] = $default;
            }
        }

        $subRequest = self::$requestStack->getCurrentRequest()->duplicate($query, null, $attributes);

        $this->response = self::$kernel->handle(
            $subRequest,
            \Symfony\Component\HttpKernel\HttpKernelInterface::SUB_REQUEST,
            false
        );

            // Display the view
        parent::display($tpl);
    }
692631
async function render(nj, templ, templateVars) {
  debug('templ before: ', templ);
  // if no vars passed, use
  // template itself as source of variables:
  if (_.isUndefined(templateVars))
    templateVars = JSON.parse(_.cloneDeep(templ));

  templ = await nj.renderStringAsync(templ, templateVars);
  if (templ.match(/\{\{.*\}\}/)) {
    // recurse
    return await render(nj, templ, templateVars);
  }
  return templ;
}
715549
protected function render($template, array $vars = [])
    {
        $pluginTemplateFolder = $this->plugin->getTemplateFolder();
        if (!empty($pluginTemplateFolder)) {
            $loader = new \Twig_Loader_Filesystem($pluginTemplateFolder);
            $this->app['twig']->getLoader()->addLoader($loader);
        }

        $defaults = [
            'layout' => [
                'title' => preg_replace('/\\.[^.\\s]{3,4}$/', '', $template)
            ]
        ];
        $vars = array_replace_recursive($defaults, $vars);

        return $this->app['twig']->render($template, $vars);
    }