Render a template

@param string        $sTemplate            The name of template to be rendered
@param string        $aVars                The template vars

@return string        The template content
974256
public function render($sTemplate, array $aVars = [])
    {
        $sTemplate = trim($sTemplate);
        // Get the namespace name
        $sNamespace = '';
        $iSeparatorPosition = strrpos($sTemplate, '::');
        if($iSeparatorPosition !== false)
        {
            $sNamespace = substr($sTemplate, 0, $iSeparatorPosition);
            $sTemplate = substr($sTemplate, $iSeparatorPosition + 2);
        }
        // The default namespace is 'jaxon'
        if(!($sNamespace = trim($sNamespace)))
        {
            $sNamespace = 'jaxon';
        }
        // Check if the namespace is defined
        if(!key_exists($sNamespace, $this->aNamespaces))
        {
            return false;
        }
        $aNamespace = $this->aNamespaces[$sNamespace];
        // Get the template path
        $sTemplatePath = $aNamespace['directory'] . $sTemplate . $aNamespace['extension'];
        // Render the template
        $xRenderer = new Renderer();
        return $xRenderer->render($sTemplatePath, $aVars);
    }
1218960
protected function parseTemplate($template, array $vars = array())
    {
        if (strpos($template, '{') === false) {
            return $template;
        }

        if (preg_match_all('@\{\$([A-Za-z0-9_]+)\}@i', $template, $matches)) {
            foreach ($matches[1] as $varName) {
                $template = str_replace('{$' . $varName . '}', $vars[$varName], $template);
            }
        }

        return $template;
    }
752311
public function render($template, array $data = [])
    {
        $isString = is_string($template);

        if ($isString && is_file($template)) {
            return $this->renderTemplate($template, $data);
        }
        if (! $isString && ! is_array($template)) {
            throw new InvalidArgumentException('Template must be a string or an array of strings.');
        }
        $path = $this->find($template);
        if ($path) {
            return $this->doRender($path, $data);
        }
        if ($isString) {
            throw new RuntimeException($template.' is not a valid template name.');
        }

        throw new RuntimeException('Not found any valid template in the array provided.');
    }
23093
public function compile(array $vars = [])
    {
        // start compilation
        if($this->compiling) {
            throw new \LogicException('Template is already compiling.');
        }
        $this->compiling = true;

        // extract user vars
        extract($vars);
        unset($vars);

        // start stream capture
        ob_start();

        // display file
        require $this->file;

        // stop stream capture
        $content = ob_get_clean();
        $content .= "\n\n";

        // compile layout
        if($this->layout) {
            list($layout, $vars) = $this->layout;
            $blocks = array_merge($this->blocks, ['__CONTENT__' => $content]);
            $content = $this->templater->render($layout, $vars, $blocks);
        }

        // end
        $this->compiling = false;
        return $content;
    }
277235
public function render($template, array $params = [])
    {
        return $this->write($this->app->getView()->render($template, $params));
    }
644284
public function renderRaw($module, $theme, $template, array $vars = array())
    {
        // Save initial values before overriding theme
        $initialLayout = $this->layout;
        $initialModule = $this->module;
        $initialTheme = $this->theme;

        // Configure view with new values
        $this->setModule($module)
             ->setTheme($theme)
             ->disableLayout();

        $response = $this->render($template, $vars);

        // Restore initial values now
        $this->layout = $initialLayout;
        $this->module = $initialModule;
        $this->theme = $initialTheme;

        return $response;
    }
661795
protected function makeResponse(string $template, array $vars = [])
    {
        if (request()->ajax()) {
            return $this->jsonOutput($vars);
        }

        return $this->renderOutput($template, $vars);
    }
631609
protected function _formatTemplate($template, array $vars) {
        $needles = array_map(create_function('$k', 'return "{{".$k."}}";'),
            array_keys($vars));
        $replacements = array_values($vars);
        // do replacements, then delete unused template vars
        return preg_replace('~{{[^}]+}}~', '',
            str_replace($needles, $replacements, $template));
    }
934664
public function render($template, array $vars = array(), $cookies = array(), $domain = null)
    {
        $vars['__menu__'] = $this->getMenu();
        if(Config::getParam('profiling.enable')) {
            $vars['__profiling__'] = Inspector::getStats();
        }
        $domain = (null === $domain) ? $this->getDomain() : $domain;
        return $this->tpl->render($domain . $template, $vars, $cookies);
    }
242483
public function render($template)
    {
        $this->setTemplate($template);
        extract($this->data);
        ob_start();
        require $this->templatePath;

        return ob_get_clean();
    }
1267502
public static function Render($template=null, $data=null)
    {
        if ($template && $data) {
            return self::$renderer->render($template, $data);
        } else {
            self::$data = self::getData();
            self::$templates[] = "index";
            self::loadTemplate(self::$templates);
        }
    }
5247
public static function make($template, array $vars = [], array $blocks = [])
    {
        if(!static::$instance) {
            static::$instance = new static;
        }

        return static::$instance->render($template, $vars, $blocks);
    }
544000
public function render()
    {
        parent::render();

        if ($sTpl = $this->getViewParameter("sWidgetType")) {
            $sTemplateName = 'widget/' . basename($sTpl) . '/categorylist.tpl';
            if (\OxidEsales\Eshop\Core\Registry::getConfig()->getTemplatePath($sTemplateName, $this->isAdmin())) {
                $this->_sThisTemplate = $sTemplateName;
            }
        }

        return $this->_sThisTemplate;
    }
589612
public function render( $execMethodName = null, array $execArgs = null )
    {
        $this->state->validate();

        // updateState() on any component can call $this->getRootComponent()->forceResponse()
        // to force a particular response, usually a redirect.
        if (null !== $this->forceResponse) {
            return $this->forceResponse;
        }
        
        $this->initTemplate();

        // If we're called with an 'exec' then run it instead of rendering the whole tree.
        // It may still render the whole tree or it may just render a portion or just return JSON
        if ($execMethodName) { // Used to test for null but it could easily be an empty string
            $this->log( "Rendering with exec: {$execMethodName}, args:".var_export($execArgs, true ), LogLevel::DEBUG );
            $out = $this->execMethod( $execMethodName, $execArgs );
        }else {
            $this->log( "Rendering without exec", LogLevel::DEBUG );
            $out = $this->template->render( $this->state, $this->props );
            if (!( $out instanceof Response )) {
                throw new \Exception( get_class( $this->template ) . " returned invalid response. Should have been an instance of ViewComponentResponse" );
            }
        }
        return $out;
    }
1218424
public function render($template, array $locals = [])
    {
        $templatePath = $this->find($template);

        if (!$templatePath) {
            throw new Exception("Unable to find template [$template]");
        }

        // View variables
        $variables = $locals + $this->globals;
        foreach ($variables as $_name => $_value) {
            $$_name = $_value;
        }

        // Shortcut for escaping HTML
        $e = function($string) {
            return htmlspecialchars($string);
        };

        // Shortcut for Language::translate()
        $t = function($string, array $vars = array()) {
            return Language::translate($string, $vars);
        };

        // Shortcut for Language::date()
        $l = function($format, $timestamp = null) {
            return Language::date($format, $timestamp);
        };

        ob_start();
        include($templatePath);
        return ob_get_clean();
    }
1135051
protected function renderTemplateString( $template, array $args = [] )
	{
		foreach( $args as $key => $value ) {
			$template = str_replace( '{'.$key.'}', $value, $template );
		}
		return trim( $template );
	}
584629
public function render(Smarty_Internal_Template $_template)
    {
        if ($_template->smarty->debugging) {
            $_template->smarty->_debug->start_render($_template);
        }
        if (!$this->processed) {
            $this->process($_template);
        }
        if (isset($_template->cached)) {
            $_template->cached->file_dependency =
                array_merge($_template->cached->file_dependency, $this->file_dependency);
        }
        $this->getRenderedTemplateCode($_template);
        if ($_template->caching && $this->has_nocache_code) {
            $_template->cached->hashes[$this->nocache_hash] = true;
        }
        if (isset($_template->parent) && $_template->parent->_objType == 2 && !empty($_template->tpl_function)) {
            $_template->parent->tpl_function = array_merge($_template->parent->tpl_function, $_template->tpl_function);
        }
        if ($_template->smarty->debugging) {
            $_template->smarty->_debug->end_render($_template);
        }
    }