Register the template path.

@param string $templateName The template name
@param string $path         The path to template

@return self
961528
public function registerTemplatePath($templateName, $path)
    {
        $this->templatesMap[(string) $templateName] = (string) $path;

        return $this;
    }
1013832
function templateFile( $templateName )
    {
        if ( isset( $this->Templates[$templateName] ) )
        {
            return $this->Templates[$templateName]['filepath'];
        }
        return false;
    }
745311
public function setCachePath($cachePath='')
    {
        if ($this->cache) {
            if (empty($cachePath)) {
                $this->cachePath = $this->templatesPath.'cache/';
            } else {
                $this->cachePath = $cachePath;
            }
            if (!is_readable($this->cachePath) || !is_writeable($this->cachePath)) {
                $this->error("Template Cache Path ({$this->cachePath}) does not exist or is not readable & writeable.");
            }
        } else {
            $this->cachePath = null;
        }
    }
986697
public function registerTemplate(TemplateInterface $template)
    {
        $templateName = $template->getName();
        $parts = explode('/', $templateName);

        if (count($parts) !== 2) {
            throw new \InvalidArgumentException(
                sprintf(
                    'Template name "%s" is not formatted properly, should be like "domain/template-name"',
                    $templateName
                )
            );
        }

        list($domain, $name) = $parts;

        $this->templates[$domain][$name] = $template;
    }
940318
public function template_fallback( $template, $template_name, $template_path ) {
		if ( ! file_exists( $template ) ) {
			// Woops, no template. Does hametwoo has it?
			$fallback = self::root_dir() . '/templates/' . $template_name;
			if ( file_exists( $fallback ) ) {
				$template = $fallback;
			}
		}
		return $template;
	}
162803
protected function validateTemplatePath()
    {
        array_walk($this->templatePath, function($val, $key) {
            if (!is_dir($val)) {
                throw new \InvalidArgumentException(sprintf('Invalid template path: %s', $val));
            }
        });
    }
558428
protected function _templatePath($path, array $vars = array())
    {
        if (strpos($path, '{') !== false) {
            preg_match_all('#\{\$([_a-z0-9]*)\}#i', $path, $matches);
            if (!empty($matches[1])) {
                foreach ($matches[1] as $var) {
                    $path = str_replace('{$' . $var . '}', isset($vars[$var]) ? $vars[$var] : null, $path);
                }
            }
        }
        return $path;
    }
1119952
function registerTemplates(filepaths, callback) {
    async.map(filepaths, registerTemplate, function (err, templates) {
      if (err) callback(err);
      callback(null, templates);
    });
  }
904864
public function setTemplateFileName($templateFileName)
    {
        if (!file_exists($this->getPathToTemplateFileName($templateFileName))) {
            throw new TemplateNotFoundException($templateFileName);
        }

        $this->templateFileName = $templateFileName;
    }
486108
protected function loadTemplatePath($templatePath)
    {
        $templatePath = $this->path->getDir($templatePath);
        if (file_exists($templatePath)) {
            require $templatePath;
        }
        return $this;
    }
490413
public function post_template_routing($template_path)
    {
        $routes_file = \get_template_directory() . '/public/routes.php';
        
        if (\is_child_theme()) {
            $routes_file = \locate_template('public/routes.php');
        }

        if ('' !== $routes_file) {
            return $routes_file;
        }
        
        return $template_path;
    }
636046
protected function resolveCachedTemplatePath($templatePath)
    {
        if (isset($this->paths[$templatePath])) {
            $path = $this->paths[$templatePath];
        } else {
            $path = $this->finder->find($templatePath);
            if (null === $path) {
                throw new RuntimeException(sprintf(
                    '%s is not a valid readable template',
                    $templatePath
                ));
            }
            $this->paths[$templatePath] = $path;
        }

        return $path;
    }
323735
protected function findTwigFile($path, $template = null)
    {
        if ($template == null) {
            $template = $this->template;
        }

        return '::' . Html::TWIG_TEMPLATE_PATH . '/' . $template . '/' . $path;
    }
498377
public function make($path, $template)
    {
        $this->name = basename($path, '.php');
        $this->path = $this->getPath($path);
        $template = $this->getTemplate($template, $this->name);

        if (! $this->file->exists($this->path))
        {
            return $this->file->put($this->path, $template) !== false;
        }

        return false;
    }
180366
public function templateFile($path, array $arguments = [])
    {
        $this->file($path)->template($this->makePath($path), $arguments);
    }
610491
public function templatePath($path = null)
    {
        deprecationWarning('ViewBuilder::templatePath() is deprecated. Use ViewBuilder::setTemplatePath() or ViewBuilder::getTemplatePath() instead.');
        if ($path !== null) {
            return $this->setTemplatePath($path);
        }

        return $this->getTemplatePath();
    }
703767
protected function renderTemplate($path = false)
    {
        if(!$this->templateEngine) {
            throw new \Exception('template engine not injected');
        }
        if(!$path) {
            $path = sprintf('%s/%s/%s', AREA, $this->name, $this->action);
        }
        $this->setCommonTemplateParameters();
        $html = $this->templateEngine->render($path, $this->templateParameters);
        $this->httpStream->write($html);
        return $html;
    }