Compiles a template using the given data.

@param string $template
@param array $data
@return string
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);
    }
988681
public function render($template,$data=[]){
		$loader = new \Twig_Loader_Filesystem($this->environment->getRootPath().'/template');
		$twig = new \Twig_Environment($loader);

		$extensionDir=$this->environment->getSrcPath().'/Twig/Extension';
		if(file_exists($extensionDir)){
			$hDir=opendir($extensionDir);
			while($file=readdir($hDir)){
				if($file=='.' || $file=='..'){
					continue;
				}
				$objName='\Twig\Extension\\'.pathinfo($file, PATHINFO_FILENAME);
				$twig->addExtension(new $objName($data));
			}

			closedir($hDir);			
		}

		return $twig->render($template, $data);
	}
1220943
public function render($template, $data){
		$rtn = $this->twig->render($template, $data);
		return $rtn;
	}
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);
    }
469653
protected function _compileTemplates(array $templates = [])
    {
        if (empty($templates)) {
            $templates = array_keys($this->_config);
        }
        foreach ($templates as $name) {
            $template = $this->get($name);
            if ($template === null) {
                $this->_compiled[$name] = [null, null];
            }

            $template = str_replace('%', '%%', $template);
            preg_match_all('#\{\{([\w\._]+)\}\}#', $template, $matches);
            $this->_compiled[$name] = [
                str_replace($matches[0], '%s', $template),
                $matches[1]
            ];
        }
    }
1118693
public function render($template, $data = [], array $options = []) {
		$defaults = ['context' => []];
		$options += $defaults;

		$context = [];
		$this->_context = $options['context'] + $this->_context;

		foreach (array_keys($this->_context) as $key) {
			$context[$key] = $this->__get($key);
		}
		$data = array_merge($this->_toString($context), $this->_toString($data));
		return Text::insert($template, $data, $options);
	}
109760
protected function _run($template, $data = NULL)
    {
        if (is_array($data)) {
            extract($data);
        }
        ob_start();
        eval(' ?>' . $template . '<?php ');
        $content = ob_get_clean();

        return $content;
    }
1131757
protected function view(string $template, array $data = []) : string
    {
        if (!$this->mustacheInstance) {
            $viewsRoute = $this->config('paths.view');
            $options = ['extension' => '.hbs'];

            $this->mustacheInstance = new Mustache_Engine(array(
                'loader' => new Mustache_Loader_FilesystemLoader($viewsRoute, $options),
                'partials_loader' => new Mustache_Loader_FilesystemLoader($viewsRoute, $options),
                'charset' => 'UTF-8',
            ));
        }

        $tpl = $this->mustacheInstance->loadTemplate($template);
        $data = array_merge($this->getData(), $data);

        return $tpl->render($this->mapData($data));
    }
1011983
private function compileTemplate($templatePath, $destinationPath, $data = null)
    {
        if ($data == null) {
            $data = $destinationPath;
            $destinationPath = null;
        }
        
        if (! isset($this->templates[$templatePath])) {
            $this->templates[$templatePath] = file_get_contents($templatePath);
        }
        
        $compiled = preg_replace_callback('/{{\s*([A-z0-9_-]+)\s*}}/', function ($matches) use ($data) {
            if (isset($data[$matches[1]])) {
                return $data[$matches[1]];
            }
            
            return $matches[0];
        }, $this->templates[$templatePath]);
        
        if ($destinationPath) {
            file_put_contents($destinationPath, $compiled);
        }
        
        return $compiled;
    }
1115314
function (template, data) {
            var p;
            for (p in data) {
                if (data.hasOwnProperty(p)) {
                    template = template.replace(new RegExp('\\{\\{' + p + '\\}\\}', 'g'), data[p]);
                }
            }
            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);
        }
    }
908193
public function template($template, $data = Array()){
        \Template::with($template, $data);
        \View::serve();
    }
186565
public function compile($template, $data = array())
    {
        $compiler = new BladeCompiler($this->files, 'theme');

        // Get blade compiler.
        $parsed = $compiler->compileString($template);

        ob_start() and extract($data, EXTR_SKIP);
        try {
            eval('?>'.$parsed);
        } catch (\Exception $e) {
            ob_end_clean(); throw $e;
        }
        $template = ob_get_contents();
        ob_end_clean();

        return $template;
    }
12406
public function render($template, $data = null)
    {
        $twig = $this->getTwig();
        $parser = $twig->loadTemplate($template);

        return $parser->render($this->all(), $data);
    }
1038144
public function fetch($template, $data = [])
    {
        $data = array_merge($this->defaultVariables, $data);

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

        return $this->smarty->fetch($template);
    }
837253
protected function responseTemplate($template, $data = array()){
        
        if(!isset(hubert()->template)){
            throw new \Exception("no template engine installed");
        }
        $html = hubert()->template->render($template, $data);
        $this->_response->getBody()->write($html);
        
        return $this->_response;
        
    }
825380
public function view($template, $data = [])
    {
        $html = ViewService::getEngine()->render($template, $data);
        $this->message->setBody($html, 'text/html');
        return $this;
    }