Initializes a StandaloneView with a template and returns it.

@param string $templatePath
@return StandaloneView
197207
private function getFluidStandaloneViewWithTemplate($templatePath = '')
    {
        $standaloneView = GeneralUtility::makeInstance(StandaloneView::class);
        $standaloneView->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName($templatePath));

        return $standaloneView;
    }
62464
private function lazy()
    {
        if ($this->twig === null) {
            if (!$this->template) {
                throw new InvalidArgumentException('The template file must be specified.');
            }

            $this->twig = $this->environment->loadTemplate($this->template);
        }

        return $this->twig;
    }
752218
public function makeView($filePath, $templatePath, $data)
    {
        if(!file_exists(resource_path($filePath)))
        {
            $view =  View::file($templatePath, $data);
            file_put_contents(resource_path($filePath), str_replace(["<%", "%>", "#", "*"], ["{{", "}}", "@", "$"], $view->render()));
        }else{
            if($this->mode == "overwrite")
            {
                $view =  View::file($templatePath, $data);
                file_put_contents(resource_path($filePath), str_replace(["<%", "%>", "#", "*"], ["{{", "}}", "@", "$"], $view->render()));
            }
        }
    }
66537
static public function create($templateName, App $app, $templateType = null) {
        if ($templateType === null) {
            $tmp          = explode('.', $templateName);
            $templateType = $tmp[count($tmp) - 1];
        } else {
            $templateType = strtolower($templateType);
        }

        return self::loadTemplate($templateName, $app, $templateType);
    }
414911
public function getFullPath()
    {
        $key = 'template.templatePath';

        if ($this->type === self::PART_BODY) {
            $key = 'template.viewPath';
        }

        $path = Configuration::get($key, null);
        if ($path === null) { // @codeCoverageIgnore
            throw new ConfigurationException("The template.templatePath or template.viewPath isn't configured right or doesn't exists!"); // @codeCoverageIgnore
        } // @codeCoverageIgnore

        $foundView = false;
        try {
            AppManager::getInstance()->initApps();
        } catch (\Exception $exception) {}
        foreach (AppManager::getInstance()->getApps() as $app) {
            $testPath = $app->getAppDirectory() . DS . $path . DS . $this->getPath();

            if (is_file($testPath)) {
                $path = $testPath;
                $foundView = true;
            }
        }

        if (! $foundView) {
            throw new NotFoundException('Template or view file not found in any apps!');
        }

        return $path;
    }
760998
def build_template(template_path)
      # FIXME: this is called every time build_template is called.
      # although this is idepodent, it's got room for optimization
      self.build_components!

      ERB.new( File.open( template_path ).read, nil, '<>' ).result(self.binding)
    end
1351904
public function bootstrap(?string $basePath = null): self
    {
        $this->createApplication($basePath);
        $this->baseKernelBinding();

        return $this;
    }
851488
public function init(string $templatesPath, string $cachePath = null) : TemplateLoaderInterface
    {

        $this->fs = new Filesystem($templatesPath);
        $this->loaders = [];

        foreach (self::$providers as $ext => $provider) {
            $this->loaders[$ext] = new $provider();
            $this->loaders[$ext]->init($templatesPath, $cachePath);
        }

        return $this;
    }
385988
public function setTemplatePathAndFilename($templatePathAndFilename)
    {
        $this->baseRenderingContext->getTemplatePaths()->setTemplatePathAndFilename($templatePathAndFilename);

        $partialRootPaths = $this->baseRenderingContext->getTemplatePaths()->getPartialRootPaths();
        $layoutRootPaths = $this->baseRenderingContext->getTemplatePaths()->getLayoutRootPaths();
        array_unshift($partialRootPaths, Files::concatenatePaths([dirname($templatePathAndFilename), 'Partials']));
        array_unshift($layoutRootPaths, Files::concatenatePaths([dirname($templatePathAndFilename), 'Layouts']));
        $this->baseRenderingContext->getTemplatePaths()->setPartialRootPaths($partialRootPaths);
        $this->baseRenderingContext->getTemplatePaths()->setLayoutRootPaths($layoutRootPaths);
    }
280532
public function getTemplate($templatePath)
    {
        $absoluteTemplateFilePath = $this->getTemplateFilePath($templatePath);
        if (!$absoluteTemplateFilePath) {
            return;
        }
        extract($this->getArrayCopy());
        ob_start();
        include $absoluteTemplateFilePath;
        $content = ob_get_contents();
        ob_end_clean();
        return $content;
    }
1088799
public function getTemplate( $templateId ){
        $path = sprintf( self::PATH_TEMPLATE_LOOKUP, $templateId );

        return $this->httpGet( $path );

    }
624252
protected function resolveTemplateFile(array $templates = array())
    {
        $templatePath = $this->getTemplatePath();

        $templates = array_merge($templates, $this->getDefaultTemplates());

        if (empty($templates)) {
            throw new Exception("No templates available.");
        }

        foreach ($templates as $templateFile) {
            $filePath = "$templatePath/$templateFile";

            if (is_file($filePath)) {
                return $filePath;
            }
        }

        return null;
    }
1349173
public function getTemplate()
    {
        if (is_null($this->_template)) {
            Template::appendPath(dirname(__FILE__).'/Views');
            $temp = new Template();
            $this->_template = $temp->initialize();
        }
        return $this->_template;
    }
97361
private function compileFiles(string $viewPath)
    {
        $directory = new RecursiveDirectoryIterator($viewPath, FilesystemIterator::SKIP_DOTS);

        foreach (new RecursiveIteratorIterator($directory, RecursiveIteratorIterator::SELF_FIRST) as $file) {
            /** @var SplFileInfo $file */
            if ($file->isFile() && $file->getExtension() === 'twig') {
                $templateName = substr($file->getPathname(), strlen($viewPath) + 1);
                $templateName = str_replace('\\', '/', $templateName);
                //echo sprintf("Parsing: %s\n", $templateName);
                $this->twig->loadTemplate($templateName);
            }
        }
    }
1364288
public function compile($templatePath, Array $templateData, $filePath)
    {
        $template = $this->filesystem->get($templatePath);

        $compiled = $this->compiler->compile($template, $templateData);

        $this->makeDirectory(dirname($filePath));

        $this->filesystem->put($filePath, $compiled);

        return $filePath;
    }
238594
public function setTemplatePath(string $path = null, string $context = null) : self
    {
        if (empty($path)) {
            $this->templatePath = $this->getPath($context)['dirname'] . '/' . $this->getPath($context)['filename'];
        } elseif (substr($path, 0, 1) == '/') {
            $this->templatePath = $path;
        } else {
            $this->templatePath = $this->getPath($context)['dirname'] . '/' . $path;
        }

        return $this;
    }
898833
protected function renderSimpleTemplate($templatePathAndFilename, array $contextVariables)
    {
        $content = file_get_contents($templatePathAndFilename);
        foreach ($contextVariables as $key => $value) {
            $content = str_replace('{' . $key . '}', $value, $content);
        }
        return $content;
    }