Make template rendering

@param string $template
@param array $data

@return string
@throws
168647
public function render($template, array $data = [])
    {
        if (is_null($this->loader)) {
            return $this->renderString($template, $data);
        }

        if (! $this->loader->exists($template)) {
            $this->loader->failLoading($template .' not found');
        }

        $this->pushSharedData($data);

        $__tintin = $this;

        extract($this->getSharedData());

        /**
         * Load template when is not a cached file
         */
        if (! $this->loader->isExpirated($template)) {
            $this->obFlushAndStar();

            require $this->loader->getCacheFileResolvedPath($template);
            
            return $this->obGetContent();
        }

        /**
         * Put the template into cache
         */
        $content = $this->loader->getFileContent($template);

        $this->loader->cache(
            $template,
            $this->compiler->compile($content)
        );

        $this->obFlushAndStar();

        require $this->loader->getCacheFileResolvedPath($template);

        return $this->obGetContent();
    }
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);
        }
    }
1129785
protected function _renderTemplate($template) {
		if ($section = $this->_findSection($template)) {
			list($before, $type, $tag_name, $content, $after) = $section;

			$rendered_before = $this->_renderTags($before);

			$rendered_content = '';
			$val = $this->_getVariable($tag_name);
			switch($type) {
				// inverted section
				case '^':
					if (empty($val)) {
						$rendered_content = $this->_renderTemplate($content);
					}
					break;

				// regular section
				case '#':
					// higher order sections
					if ($this->_varIsCallable($val)) {
						$rendered_content = $this->_renderTemplate(call_user_func($val, $content));
					} else if ($this->_varIsIterable($val)) {
						foreach ($val as $local_context) {
							$this->_pushContext($local_context);
							$rendered_content .= $this->_renderTemplate($content);
							$this->_popContext();
						}
					} else if ($val) {
						if (is_array($val) || is_object($val)) {
							$this->_pushContext($val);
							$rendered_content = $this->_renderTemplate($content);
							$this->_popContext();
						} else {
							$rendered_content = $this->_renderTemplate($content);
						}
					}
					break;
			}

			return $rendered_before . $rendered_content . $this->_renderTemplate($after);
		}

		return $this->_renderTags($template);
	}
1015661
public function render($templates, array $data = array())
    {
        $__templates = (array) $templates;

        extract($data);
        ob_start();

        foreach ($__templates as $__template) {
            $__template = $this->templatesPath.$__template;

            if (is_readable($__template) && is_file($__template)) {
                include $__template;
            } else {
                ob_end_clean();
                throw new \Shade\Exception('Template file "'.$__template.'" does not exists');
            }
            $content = ob_get_clean();
        }

        return $content;
    }
1035998
public function compile($template, $data)
    {
        foreach ($data as $key => $value) {
            $key = strtoupper($key);

            if(is_bool($value))
                $value = $value ? 'true' : 'false';

            $template = preg_replace("#\\$$key\\$#i", $value, $template);
        }

        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;
    }
1038144
public function fetch($template, $data = [])
    {
        $data = array_merge($this->defaultVariables, $data);

        $this->smarty->assign($data);

        return $this->smarty->fetch($template);
    }
1154565
protected function replace(array $data, $template, $prefix = null)
    {
        foreach ($data as $k => $d) {
            if (is_array($d)) {
                return $this->replace($d, $template, $k . '.');
            } else {
                $template = str_replace('{' . (!empty($prefix) ? $prefix . $k : $k) . '}', $d, $template);
            }
        }

        return $template;
    }
505656
public function renderSections($template, array $data = [], $class = null)
    {
        $outputs = new \stdClass();
        $setter = function ($name, $content) use ($outputs) {
            $outputs->$name = $content;
        };
        $this->events->on('f.sections.content', $setter);
        $this->render($template, $data, $class);
        $this->events->removeListener('f.sections.content', $setter);

        return get_object_vars($outputs);
    }
631885
public function render($templateName = null, $data = [])
    {
        $this->setTemplate($templateName, $data);

        return json_encode($this->_data);
    }
1270713
public function renderHtml($template=null, $data=null)
    {
        $this->beforeRender($data);
        
        $this->beforeRenderView();
        
        $template = !empty($template) ? $template : $this->getName();
        
        $string = $this->module->getView()->render($template, $this->responseData());
        
        return $this->renderText($string);
    }
133854
public function render(ResponseInterface $response, $template, $data = [])
    {
         $response->getBody()->write($this->fetch($template, $data));

         return $response;
    }
811148
public function render($template, array $context = array())
    {
        $template = $this->twig->createTemplate($template);

        return $template->render($context);
    }
700130
public function template($template, $data = array(), $options = '')
    {
        $this->template = array($template, $data, $options);
        $template = new Template(Base::getInstance());
        $this->loaderHooks($template,'pre_template',$class='',$method_name='',$data=array());
        return $template;
    }
640517
public static function vsprintf($template, array $data, \Closure $onError = null)
    {
        if (!is_string($template)) {
            return '';
        }
        if ($template && !(empty($data))) {
            try {
                $template = vsprintf($template, $data);
            } catch (\Exception $e) {
                if ($onError) {
                    call_user_func($onError, $e);
                }
            }
        }

        return $template;
    }
858336
public function render(string $template, array $data = []) : string
    {
        try {
            return $this->renderer->render($template, $data);
        } catch (Twig_Error_Loader $e) {
            throw new TemplateNotFoundException("Template '$template' not found by Twig renderer",
                null, $e);
        }
    }
163730
public function mail($template, $data = array(), &$css = array())
    {
        $this->twig->addFunction(new \Twig_SimpleFunction('css', function ($file) use (&$css) {
            $css[] = $file;
        }));
        $template = $this->twig->loadTemplate($template);
        return $template->render($data);
    }