Loads a template.

@return Storage|bool false if the template cannot be loaded, a Storage instance otherwise
187190
public function load(TemplateReferenceInterface $template)
    {
        $key = hash('sha256', $template->getLogicalName());
        $dir = $this->dir.\DIRECTORY_SEPARATOR.substr($key, 0, 2);
        $file = substr($key, 2).'.tpl';
        $path = $dir.\DIRECTORY_SEPARATOR.$file;

        if (is_file($path)) {
            if (null !== $this->logger) {
                $this->logger->debug('Fetching template from cache.', ['name' => $template->get('name')]);
            }

            return new FileStorage($path);
        }

        if (false === $storage = $this->loader->load($template)) {
            return false;
        }

        $content = $storage->getContent();

        if (!is_dir($dir) && !@mkdir($dir, 0777, true) && !is_dir($dir)) {
            throw new \RuntimeException(sprintf('Cache Loader was not able to create directory "%s"', $dir));
        }

        file_put_contents($path, $content);

        if (null !== $this->logger) {
            $this->logger->debug('Storing template in cache.', ['name' => $template->get('name')]);
        }

        return new FileStorage($path);
    }
1339528
public function TemplateFile()
    {
        if (!$this->AllowCustomTemplates() ||
                !$this->content || !$this->content->GetTemplate())
        {
            return $this->BuiltInTemplateFile();
        }
        $file = Path::Combine(PathUtil::ModuleCustomTemplatesFolder($this), $this->content->GetTemplate());
        return Path::AddExtension($file, 'phtml');
    }
74770
public function getTemplate()
    {
        if($this->template != ''){
            return $this->template;
        }

        if(($defaultTemplate = $this->container->getConfigInstance()->getDefaultTemplateName()) == null){
            return '';
        }

        return $defaultTemplate;
    }
1013832
function templateFile( $templateName )
    {
        if ( isset( $this->Templates[$templateName] ) )
        {
            return $this->Templates[$templateName]['filepath'];
        }
        return false;
    }
1231995
public function load($name) {
		
		if (!isset($this->templates[$name])) {
			try {
				$this->templates[$name] = $this->loadFile($name);
			} catch (Exception $e) {
				print "The partial, ".$name.", wasn't found so a pattern failed to build.\n";
			}
		}
		
		return (isset($this->templates[$name])) ? $this->templates[$name] : false;
		
	}
1182335
protected function loadTemplates()
    {
        if ($this->templates === null) {
            $this->templates = array();
            $data = file_get_contents($this->fileName, false, null, $this->offset);
            foreach (preg_split("/^@@(?= [\w\d\.]+$)/m", $data, -1) as $chunk) {
                if (trim($chunk)) {
                    list($name, $content)         = explode("\n", $chunk, 2);
                    $this->templates[trim($name)] = trim($content);
                }
            }
        }
    }
1003473
public function getAllTemplates()
    {
        $strCacheDir = $this->container->getParameter('kernel.cache_dir');

        // Try to load from cache
        if (file_exists($strCacheDir.'/contao/config/twig-templates.php')) {
            self::$twigFiles = include $strCacheDir.'/contao/config/twig-templates.php';

            return self::$twigFiles;
        }

        $bundles = $this->kernel->getBundles();

        if (\is_array($bundles)) {
            foreach (array_reverse($bundles) as $key => $value) {
                $path = $this->kernel->locateResource("@$key");

                $dir = rtrim($path, '/').'/Resources/views';

                if (!is_dir($dir)) {
                    continue;
                }
                $finder = new Finder();
                $twigKey = preg_replace('/Bundle$/', '', $key);

                foreach ($finder->in($dir)->files()->name('*.twig') as $file) {
                    /** @var SplFileInfo $file */
                    $name = $file->getBasename();
                    $legacyName = false !== strpos($name, 'html.twig') ? $file->getBasename('.html.twig') : $name;

                    if (isset(self::$twigFiles[$name])) {
                        continue;
                    }

                    self::$twigFiles[$name] = "@$twigKey/".$file->getRelativePathname();

                    if ($legacyName !== $name) {
                        self::$twigFiles[$legacyName] = self::$twigFiles[$name];
                    }
                }
            }
        }

        foreach ($this->container->get('contao.resource_finder')->findIn('templates')->name('*.twig') as $file) {
            $name = $file->getBasename();
            $legacyName = false !== strpos($name, 'html.twig') ? $file->getBasename('.html.twig') : $name;

            /* @var SplFileInfo $file */
            self::$twigFiles[$name] = $file->getRealPath();

            if ($legacyName !== $name) {
                self::$twigFiles[$legacyName] = self::$twigFiles[$name];
            }
        }

        // add root templates
        $rootTemplates = $this->findTemplates($this->containerUtil->getProjectDir().'/templates/');

        if (\is_array($rootTemplates)) {
            foreach ($rootTemplates as $file) {
                $name = basename($file);
                $legacyName = false !== strpos($name, 'html.twig') ? basename($file, '.html.twig') : $name;

                self::$twigFiles[$name] = $file;

                if ($legacyName !== $name) {
                    self::$twigFiles[$legacyName] = self::$twigFiles[$name];
                }
            }
        }

        return self::$twigFiles;
    }
851047
protected function evaluate(Storage $template, array $parameters = array())
    {
        $this->template = $template;
        $this->parameters = $parameters;
        unset($template, $parameters);

        extract($this->parameters, EXTR_SKIP);
        $this->parameters = null;

        if ($this->template instanceof FileStorage) {

            ob_start();
            require $this->template;
            $this->template = null;

            return ob_get_clean();

        } elseif ($this->template instanceof StringStorage) {

            ob_start();
            eval('; ?>'.$this->template.'<?php ;');
            $this->template = null;

            return ob_get_clean();
        }

        return false;
    }
139614
protected function getTemplate()
    {
        //if no template
        if(!$this->template) {
            //Action folder and template folder
            //are in the same directoryby default

            // Sample\Namespace\Action\Can\Be\Anywhere
            $index = 'Action\\';
            $root = strpos(get_class($this), $index);
            $root += strlen($index);

            $this->template = eve('string')
                // \Can\Be\Anywhere
                ->set('\\'.substr(get_class($this), $root))
                // /Can/Be/Anywhere
                ->str_replace('\\', DIRECTORY_SEPARATOR)
                // /can/be/anywhere
                ->strtolower()
                // jic
                ->str_replace('//', '/')
                //done
                ->get();
        }

        return $this->template;
    }
522291
private function loadTemplate($template)
    {
        if (!array_key_exists($template, $this->templateCache)) {
            $this->templateCache[$template] = $this->twig->loadTemplate($template);
        }

        return $this->templateCache[$template];
    }
1349173
public function getTemplate()
    {
        if (is_null($this->_template)) {
            Template::appendPath(dirname(__FILE__).'/Views');
            $temp = new Template();
            $this->_template = $temp->initialize();
        }
        return $this->_template;
    }
868271
public function storageProperty()
    {
        if ($this->storageProperty === null) {
            $obj = $this->obj();
            if ($obj instanceof TemplateableInterface) {
                $this->setStorageProperty($obj->property('template_options'));
            } else {
                throw new RuntimeException(sprintf(
                    'Storage property owner is not defined for "%s"',
                    get_class($this)
                ));
            }
        }

        return $this->storageProperty;
    }
560154
public function load($data = array())
    {
        $current = $this->_template->getPath();

        if (!$current) {
            throw new LibBaseTemplateException('There are no template being rendered');
        }

        if (!isset($this->_paths[$current])) {
            $previous = null;
            $search_paths = $this->_template->getSearchPaths();
            $template = null;
            $search_path = null;
            foreach ($search_paths as $path) {
                if (strpos($current, $path) === 0) {
                    $search_path = $path;
                    $template = str_replace($path.'/', '', $current);
                    break;
                }
            }

            if ($search_path) {
                $search_paths = array_slice($search_paths, array_search($search_path, $search_paths) + 1);
                foreach ($search_paths as $path) {
                    $file = $path.'/'.$template;
                    if ($this->_template->findFile($file)) {
                        $previous = $file;
                        break;
                    }
                }
            }

            if (!$previous) {
                throw new LibBaseTemplateException("The {$current} template has no previous");
            }

            $this->_paths[$current] = $previous;
        }

        return $this->_template->loadFile($this->_paths[$current], $data);
    }
1102486
protected function load($name)
    {
        if (!$this->initialized) {
            $this->initialize();
        }

        if (isset($this->cache[$name])) {
            return $this->cache[$name];
        }

        $cache = $this->cachePath ? sprintf('%s/%s.cache', $this->cachePath, sha1($name)) : false;

        if (!$cache) {

            $storage = new StringStorage($this->compile($this->loader->getSource($name), $name));

        } else {

            if (!is_file($cache) || !$this->isTemplateFresh($name, filemtime($cache))) {
                $this->writeCacheFile($cache, $this->compile($this->loader->getSource($name), $name));
            }

            $storage = new FileStorage($cache);
        }

        return $this->cache[$name] = $storage;
    }
327587
private function getCacheFile()
    {
        if (is_null($this->cachePath) || !file_exists($this->cachePath)) {
            $this->error('Invalid Cache Path. '.$this->cachePath);
            return false;
        }
        $cacheKey = is_null($this->cacheKey) ? md5($this->templateFile) : $this->cacheKey;
        return($this->cachePath . $cacheKey);
    }
276190
protected function load($template){
		$template = get_stylesheet_directory()."/templates/admin/{$template}.php";
		/**
		 * wpametu_admin_screen_template
		 *
		 * @param string $template
		 * @param string $class_name
		 * @return string
		 */
		$template = apply_filters('wpametu_admin_screen_template', $template, get_called_class());
		if( file_exists($template) ){
			include $template;
		}
	}
213486
public static function get($template) {
		if(self::$twig === null)
			self::initialize();

		return self::$twig->loadTemplate($template . '.twig');
	}