@param $templateName

@return $this
779550
public function setTemplateName($templateName)
    {
        if (!$this->id) {
            $this->getContentRoute()->setClassType(get_class($this));
            $this->getContentRoute()->setLocale($this->getLocale());
        }
        $this->getContentRoute()->setTemplateName($templateName);

        return $this;
    }
230480
public function getTemplateLabel($name, $templateSetName)
    {
        if (
            isset($this->templateSet[$templateSetName]) &&
            isset($this->templateSet[$templateSetName]['templates']) &&
            isset($this->templateSet[$templateSetName]['templates'][$name])
        ) {
            return $this->templateSet[$templateSetName]['templates'][$name]['label'];
        }

        throw new NonExistingTemplateException();
    }
1268701
public static function selectTemplateItem(
        $templateState,
        $templateKey
    ) {
        $templateState = (object) $templateState;
        $templateKey = (string) $templateKey;

        $templateItem = $templateState->template->$templateKey;

        return $templateItem;
    }
732036
public function apply(&$templateString) {

		$application	= Application::getInstance();
		$config			= $application->getConfig();

		$locale = $application->getCurrentLocale();

		// without locale replace placeholders with their identifier

		if(empty($locale)) {

			$templateString = preg_replace(
				array(
					'@\{![a-z0-9_]+\}@i',
					'@\{![a-z0-9_]+:(.*?)\}@i'
				),
				array(
					'',
					'$1'
				),
				$templateString
			);
			return;

		}

		$this->getPhrases($locale);

		$templateString = preg_replace_callback(
			'@\{!([a-z0-9_]+)(:(.*?))?\}@i',
			array($this, 'translatePhraseCallback'),
			$templateString
		);
	}
32234
public function getTemplate($name, $templateSetName)
    {
        if (
            isset($this->templateSet[$templateSetName]) &&
            isset($this->templateSet[$templateSetName]['templates']) &&
            isset($this->templateSet[$templateSetName]['templates'][$name])
        ) {
            return $this->templateSet[$templateSetName]['templates'][$name];
        }

        throw new NonExistingTemplateException();
    }
92576
public function setTemplate(string $template): self
    {
        $projectDir = System::getContainer()->get('huh.utils.container')->getProjectDir();

        $this->template = $projectDir.\DIRECTORY_SEPARATOR.ltrim(preg_replace('#^'.$projectDir.'#', '', $template), \DIRECTORY_SEPARATOR);

        return $this;
    }
73817
public function setTemplate($template)
    {
        if (is_string($template)) {
            $template = new TemplateView($template);
        }
        $template->mergeData([
            'layout' => $this
        ]);
        $this->addChild(new Part($template, 'template'));
        return $this;
    }
553909
public function onLoadComponentTemplate(Template $template, $fileName)
	{
		if (!$this->activeTheme) {
			return;
		}

		$path = $this->activeTheme->getPath() . 'templates' . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . $fileName;
		if (file_exists($path)) {
			$template->setFile($path);
		} elseif ($parent = $this->activeTheme->getParent()) {
			$parentTheme = $this->getTheme($parent);
			$path = $parentTheme->getPath() . 'templates' . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . $fileName;
			if (file_exists($path)) {
				$template->setFile($path);
			}
		}
	}
293941
public function apply(&$templateString) {

		$templateString = preg_replace_callback(
			'~<a(.*?)\s+href=("|\')\$([a-z0-9_]+[a-z0-9_.\/-]*)(.*?)\2(.*?)>~i',
			array($this, 'filterHrefWithPath'),
			$templateString
		);

		$templateString = preg_replace_callback(
			'~<a(.*?)\s+href=("|\')\$\/([a-z0-9_.-]+)(.*?)\2(.*?)>~i',
			array($this, 'filterHref'),
			$templateString
		);

	}
486108
protected function loadTemplatePath($templatePath)
    {
        $templatePath = $this->path->getDir($templatePath);
        if (file_exists($templatePath)) {
            require $templatePath;
        }
        return $this;
    }
221803
public function render($templateName = null, $data = [])
    {
        $this->setTemplate($templateName, $data);

        if (empty($this->_templateName)) {
            if (defined('FOCUS_DEBUG') && FOCUS_DEBUG) {
                $this->getLogger()->debug('template name is null');
            }

            throw new \RuntimeException('TEMPLATE_IS_NULL');
        }
        $buffer = $this->_parseTemplate($this->_templateName, $this->_data);
        if (!empty($this->_layout)) {
            if (defined('FOCUS_DEBUG') && FOCUS_DEBUG) {
                $this->getLogger()->debug('loading layout: '.$this->_layout);
            }

            $buffer = $this->_parseTemplate(
                $this->_layout,
                array_merge($this->_data, ['__body__' => $buffer])
            );
        }

        return $buffer;
    }
1087834
private function setTemplatePath($templatePath)
  {
    $return = false;

    if (is_string($templatePath)) {
      if ($this->checkTemplatePath($templatePath) === true) {
        $this->templatePath[] = $templatePath;

        $return = true;
      }
    }
    else if (is_array($templatePath)) {
      foreach ($templatePath as $path) {
        if ($this->checkTemplatePath($path) === true) {
          $this->templatePath[] = $path;

          $return = true;
        }
      }
    }

    return $return;
  }
1167195
private function getTemplateResult($templateName, array $args)
    {
        $templatePath = $this->templatePath . DIRECTORY_SEPARATOR . $templateName . '.php';
        if (!file_exists($templatePath)) {
            throw new TemplateNotFoundException($templateName);
        }
        ob_start();
        extract($args);
        include $this->templatePath . DIRECTORY_SEPARATOR . $templateName . '.php';

        return ob_get_clean();
    }
218165
public function javascriptTemplateRender($templateName, $viewData) {
    /** @var $templateEngine \Twig_Environment */
    $templateEngine = $this->getTemplateEnv();
    return $templateEngine->render($templateName, $viewData);
  }
110293
public function deleteCompiledFile($templateName)
    {
        $className = $this->jigConverter->getClassNameFromFilename($templateName);
        $compileFilename = $this->jigConfig->getCompiledFilenameFromClassname($className);
        $deleted = @unlink($compileFilename);

        return $deleted;
    }
897845
public function getTemplatePath($templateName)
    {
        $fileName = "$templateName.php";
        foreach ($this->paths as $path) {
            $fullPath = $path . DIRECTORY_SEPARATOR . $fileName;
            if (is_file($fullPath)) {
                return $fullPath;
            }
        }
        return false;
    }
62804
public function tryLoad($filename)
    {
        if (is_readable($filename) && is_file($filename)) {
            $this->loadTemplateFromString(file_get_contents($filename));
            $this->source = 'loaded from file: '.$filename;

            return $this;
        }

        return false;
    }