Renders the partial template.

@param  string $template
@param  array  $data
@return string
765291
public function render($template, array $data = array())
    {
        $data = array_merge($data, $this->website->helpers());

        $data['config'] = $this->website;

        $renderer = $this->website->renderer();

        return $renderer->render($template, $data);
    }
78954
public static function from($template,$data=null){
      $view = new self($template);
      return $data ? $view->with($data) : $view;
    }
982833
protected static function textInsertion($template, array $data)
    {
        $replacements = [];
        foreach($data as $key => $value)
        {
            $replacements['{{' . $key . '}}'] = $value;
        }

        return strtr($template, $replacements);
    }
18643
final public function render($template=null, $data=null)
    {
        $renderType = $this->getRenderType();
        switch ($renderType) {
            case 'json':
                $this->renderJson($data);
                break;
            case 'xml':
                $this->renderXml($data);
                break;
            case 'html':
                $this->renderHtml($template, $data);
                break;
            default:
                $string = print_r($data, true);
                $this->renderText($string);
                break;
        }
        
        return $this->response;
    }
674536
public function textTemplate($template, $data=[]) {
		$data['message'] = $this;
		$res = $this->buildTemplate($template, $data);
		return $this->text($res);
	}
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);
    }
1156180
public function render(\Laasti\Views\Template $template)
    {
        $filepath = $this->findTemplateFile($template->getView());
        if ($template->getData() instanceof \Laasti\Views\Data\DataInterface) {
            $data = $template->getData()->toArray();
        } else {
            $data = $template->getData();
        }
        foreach ($data as $key => $value) {
            ${$key} = $value;
        }
        ob_start();
        include $filepath;
        $content = ob_get_contents();
        @ob_end_clean();
        return $content;
    }
825380
public function view($template, $data = [])
    {
        $html = ViewService::getEngine()->render($template, $data);
        $this->message->setBody($html, 'text/html');
        return $this;
    }
486427
public function renderPage(string $template, array $data = []): string
    {
        $this->thisShouldMakeItUniqueCodeCollabTemplateHtmlVariables = $data;

        /** @noinspection PhpUnusedLocalVariableInspection */
        $content = $this->render($template, $data);

        try {
            ob_start();

            /** @noinspection PhpIncludeInspection */
            require $this->thisShouldMakeItUniqueCodeCollabTemplateHtmlBasePage;
        } finally {
            $output = ob_get_clean();
        }

        return $output;
    }
356909
public function renderString(string $template, array $data = [])
    {
        try {
            return $this->loadFromString($template)->render($data);
        } catch (SyntaxError $e) {
            if ($this->exceptionHandler) {
                $e->setTemplateContent($template);

                return $this->renderSyntaxError($e);
            } else {
                throw $e;
            }
        }
    }
182873
public function compile($template, $data)
    {
        foreach ($data as $key => $value) {
            // TODO refactor code so that we do not need this check
            if (!is_string($value)) {
                continue;
            }

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

        return preg_replace('/(<?php)/', "$1\n" . $this->renderBanner(), $template, 1);
    }
837424
protected static function evalTemplateConditionals($template, array $data, array $conditionals = null)
    {
        // find all conditionals
        if(!isset($conditionals))
            $conditionals = self::getTemplateConditionals($template);

        if(empty($conditionals))
            return $template;

        // check them all
        foreach($conditionals['set'] as $conditional)
        {
            if(isset($data[$conditional]))
                $template = str_replace(['{{ifdef '. $conditional . '}}', '{{endif ' . $conditional . '}}'], '', $template);
            else
                $template = preg_replace('#\{\{ifdef ' . $conditional . '\}\}[\s\S]*\{\{endif ' . $conditional . '\}\}#', '', $template);
        }

        foreach($conditionals['not_set'] as $conditional)
        {
            if(!isset($data[$conditional]))
                $template = str_replace(['{{ifndef '. $conditional . '}}', '{{endif ' . $conditional . '}}'], '', $template);
            else
                $template = preg_replace('#\{\{ifndef ' . $conditional . '\}\}[\s\S]*\{\{endif ' . $conditional . '\}\}#', '', $template);
        }

        return $template;
    }
332885
protected function renderTemplate($input, $outputFile, $template, $templates, $data = [])
    {
        $paths = [$templates];

        if ($templates = $input->getOption('templates')) {
            $paths []= $templates;
        }

        $paths = array_filter($paths);

        $loader = new Twig_Loader_Filesystem($paths);
        $twig = new Twig_Environment($loader);


        $template = $twig->loadTemplate($template);

        $dataOption = $input->getOption('data');

        if (file_exists($dataOption)) {
            $dataOption = file_get_contents($dataOption);
        }

        $dataOption = json_decode(stripcslashes($dataOption), true);

        if (!is_array($dataOption)) {
            $dataOption = [];
        }

        $data = array_merge($data, $dataOption);

        @mkdir(dirname($outputFile), 0755, true);
        file_put_contents($outputFile, $template->render($data));
    }
585672
protected function load(string $template, array $data): string
    {
        extract($data);

        $buffer = "";
        ob_start();
        include $this->templateDir . $template;
        $buffer = ob_get_contents();
        ob_end_clean();
        return $buffer;
    }
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);
    }
203523
public function render($source, array $data = array())
    {
        parent::render($source, $data);

        //Load the template
        if($this->getObject('filter.path')->validate($source))
        {
            $source_file = $this->locateSource($source);

            if(!$cache_file = $this->isCached($source_file))
            {
                $source     = $this->loadSource($source_file);
                $source     = $this->compileSource($source);
                $cache_file = $this->cacheSource($source_file, $source);
            }
        }
        else
        {
            $name        = crc32($source);
            $source_file = '';

            if(!$cache_file = $this->isCached($name))
            {
                $source     = $this->compileSource($source);
                $cache_file = $this->cacheSource($name, $source);
            }
        }

        //Include the template
        $result = include $cache_file;

        //Render the debug information
        return  $this->renderDebug($result);
    }
134805
public function render($template, $data = NULL, $return = FALSE)
    {
        if (isset($data)) {
            $this->set_data($data);
        }
        // Compile and run template
        $compiled = $this->_compile($template);
        $content  = $this->_run($compiled, $this->_data);
        if (!$return) {
            $this->output->append_output($content);
        }

        return $content;
    }