Render Template (php file aja)

@param string $templateFile
@param unknown $data
350984
public function render($templateFile = '', $data = array())
    {
        if (!empty($templateFile)) {
            $cacheDir = realpath($this->appPath . DIRECTORY_SEPARATOR . '..') . DIRECTORY_SEPARATOR . 'storage' . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR . 'templates';
            $cacheFile = $cacheDir . DIRECTORY_SEPARATOR . MD5($this->viewPath . str_replace('.' . $this->config['templateExtension'], '', $templateFile)) . '.php';

            if (!file_exists($cacheFile) || ($this->config['cache'] === 'false' || $this->config['cache'] === false)) {
                $templateTmp = file_get_contents($this->viewPath . DIRECTORY_SEPARATOR . $templateFile);
                preg_match_all("~\{\{\s*(.*?)\s*\}\}~", $templateTmp, $block);
                foreach ($block[1] as $k => $v) {
                    if ($v === 'php') {
                        $templateTmp = str_replace('{{php}}', '<?php', $templateTmp);
                    } elseif ($v === '/php') {
                        $templateTmp = str_replace('{{/php}}', '?>', $templateTmp);
                    } else {
                        $blockTemplate = $this->includeBlock($v);
                        $templateTmp = str_replace('{{' . $v . '}}', $blockTemplate, $templateTmp);
                    }
                }
                $templateTmp .= "\n <!-- Generated at: " . date('Y-m-d H:i:s') . " -->";
                $fp = fopen($cacheFile, 'w');
                $write = fwrite($fp, $templateTmp);
                fclose($fp);
            }
            extract((array) $data);
            require_once $cacheFile;
        }
    }
10723
public function render($template, $data = array()) {
		if(!is_null($this->layout) && $this->enabled === TRUE) { // Render the layout!!
			$this->setLayoutData('content', parent::render($template, array_merge($this->layoutData, (array)$data)));
			$this->setLayoutData('js', $this->jsAssets->render());
			$this->setLayoutData('css', $this->cssAssets->render());
			$this->setLayoutData('title', $this->titleParts->render());

			return parent::render($this->layout, $this->layoutData);
		} else {
			return parent::render($template, $data);
		}
	}
945529
public function render(View $template, array $data = array())
    {
        if (! empty($this->data)) {
            $data = array_merge($this->data, $data);
        }

        // Load file into string
        $source = file_get_contents($template->getFullPath());

        if ($source === false) {
            throw new FileNotFoundException("View file '" . $template->getFullPath() . "' is not found!"); // @codeCoverageIgnore
        }

        return $this->environment->render($template->getPath(), $data);
    }
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;
    }
1328638
public function render($template, $data = [], $code = 200, array $headers = [])
    {
        $this->code = $code;

        $this->withHeaders($headers);

        $view = View::parse($template, $data);

        $this->content = $view->sendContent();

        return $this->buildHttpResponse();
    }
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;
    }
1233288
public function render(string $template, array $data = []): string
    {
        // we store the current state of the template variables
        // so that we have isolated cases on multiple calls to render()
        $backupVariables = $this->thisShouldMakeItUniqueCodeCollabTemplateHtmlVariables;

        if (!empty($data)) {
            $this->thisShouldMakeItUniqueCodeCollabTemplateHtmlVariables = $data;
        }

        try {
            ob_start();

            /** @noinspection PhpIncludeInspection */
            require $template;
        } finally {
            $output = ob_get_clean();
        }

        $this->thisShouldMakeItUniqueCodeCollabTemplateHtmlVariables = $backupVariables;

        return $output;
    }
1048152
protected function _render(string $viewFile, array $data = []): string
    {
        if (empty($data)) {
            $data = $this->viewVars;
        }

        if (substr($viewFile, -3) === 'php') {
            $out = parent::_render($viewFile, $data);
        } else {
            $data = array_merge(
                $data,
                iterator_to_array($this->helpers()->getIterator()),
                [
                    '_view' => $this,
                ]
            );

            try {
                $out = $this->getTwig()->loadTemplate($viewFile)->render($data);
            } catch (Exception $e) {
                $previous = $e->getPrevious();

                if ($previous !== null && $previous instanceof Exception) {
                    throw $previous;
                } else {
                    throw $e;
                }
            }
        }

        return $out;
    }
933682
protected function templateToString($template, array $data)
    {

        $templateFullName = $this->getTemplateFullName($template);

        if (!is_file($templateFullName)) {
            throw new RuntimeException("View cannot render `$template` because the template does not exist");
        }

        $fullData = array_merge($this->attributes, $data);
        $this->levelStartObcache = ob_get_level();
        $this->startSection($this->courentSection);
        $this->protectedIncludeScope($templateFullName, $fullData);
        $output = $this->endSection(true);
        $this->sectionContent[self::CONTENT] = $this->sectionContent[self::C_CONTENT];
        unset($this->sectionContent[self::C_CONTENT]);
        while (ob_get_level() > $this->levelStartObcache) {
            ob_end_clean();
        }

        if (!empty($this->layout)) {
            $layout = $this->layout;
            $this->layout = '';
            return $this->templateToString($layout, $fullData);
        }

        return $output;
    }
273008
public function render(string $templatePrefix, array $data): string
    {
        $formLayout = $this->layoutManager->getDefaultLayout();

        if ($formLayout instanceof HorizontalFormLayout) {
            $templateName = $templatePrefix . '_horizontal';
        } else {
            $templateName = $templatePrefix . '_default';
        }

        $template = new FrontendTemplate($templateName);
        $template->setData($data);
        $this->prepare($template);

        return $template->parse();
    }
1160087
protected function render( $data ) {

		$template = Component::WP_Plugin_Rating()->getOption( 'path', 'template' );

		$this->view->renderizate( $template, 'component', $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;
    }
482332
protected function display($templateFile='',$charset='',$contentType='',$content='',$prefix='') {
        $this->view->display($templateFile,$charset,$contentType,$content,$prefix);
    }
159610
public function setTemplateFile(string $templateFile)
    {
        if (!$templateFile) {
            return $this;
        }
        $this->templateFile = (string) $templateFile;

        return $this;
    }
596134
function display($template_file) {
        $template = $this->twig->load($template_file);
        echo $template->render($this->twig_vars);
    }
1367006
public function render($template = '', $data = []) {
		if (!isset($this->blocks[$template])) {
			$this->blocks[$template] = $this->blockFactory->create($template);
		}
		$block = $this->blocks[$template];
		$block->setData($data);
		return $block->render();
	}
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;
    }