Gets & executes a template source.

@access public
@param string $tpl The template to process; if null, uses the
default template set with setTemplate().
@return mixed The template output string, or a SavantPHPerror.
501587
public function fetch($tpl = null)
    {
        // make sure we have a template source to work with
        if (is_null($tpl)) {
            $tpl = $this->configList[self::TPL_FILE];
        }
        $result = $this->getPathToTemplate($tpl);

        if (! $result || $this->isError($result)) { //if no path
            return $result;
        } else {
            $this->configList[self::FETCHED_TPL_FILE] = $result;
            unset($result);
            unset($tpl);

            // buffer output so we can return it instead of displaying.
            ob_start();

            include $this->configList[self::FETCHED_TPL_FILE];
            $this->configList[self::FETCHED_TPL_FILE] = null; //flush fetched script value

            return ob_get_clean();
        }
    }
101698
public static function instance( $tpl = null, $module = null, $params = null, $className = null )
    {
        $object = null;
        if ( is_null( $className ) )
        {
            $ini = eZINI::instance( 'ezcomments.ini' );
            $className = $ini->variable( 'ManagerClasses', 'SubscriptionManagerClass' );
        }

        if ( !is_null( self::$instance ) )
        {
            $object = self::$instance;
        }
        else
        {
            $object = new $className();
            $object->tpl = $tpl;
            $object->module = $module;
            $object->params = $params;
        }
        return $object;
    }
1173306
function &get_template_vars($name=null)
	{
		if(!isset($name)) {
			return $this->_tpl_vars;
		} elseif(isset($this->_tpl_vars[$name])) {
			return $this->_tpl_vars[$name];
		} else {
			// var non-existant, return valid reference
			$_tmp = null;
			return $_tmp;
		}
	}
1202014
private function loadTemplate() {

		if(!empty($this->template)) {
			return true;
		}

		$path = Application::getInstance()->getRootPath() . (defined('FORMTEMPLATES_PATH') ? str_replace('/', DIRECTORY_SEPARATOR, ltrim(FORMTEMPLATES_PATH, '/')) : '');

		if(!file_exists($path . $this->tplFile)) {
			throw new HtmlFormException("Template file '$path{$this->tplFile}' does not exist.", HtmlFormException::TEMPLATE_FILE_NOT_FOUND);
		}

		$this->template = @file_get_contents($path . $this->tplFile);

		return true;
	}
231292
def retrieve_tmpl(args):
    
    password = get_password(args)
    token = connect.get_token(args.username, password, args.server)

    if args.__dict__.get('template'):
        # When specified template identifier
        template = args.template
        processing.get_template(args.server, token, template)

    else:
        # When get all templates
        processing.get_all_templates(args.server, token)
740583
protected function getTemplateData($template) {
		// firstly, check for current locale, if it was set
		if ($this->locale != '') {
			$tdata = $this->getTemplateDataForLocale($template,$this->locale);
			
			// found for this locale. return
			if (is_array($tdata)) {
				return $tdata;
			}
		}
		
		// check for default locale
		// for example, didn't find for locale `ge` but found for default `en`
		if ($this->deflocale != '') {
			$tdata = $this->getTemplateDataForLocale($template,$this->deflocale);
			
			if (is_array($tdata)) {
				return $tdata;
			}
		}
		
		// if nothing found for both locales then check in root templates folder
		// this is normal case for non-internation application where 
		// locales are not used
		$tdata = $this->getTemplateDataForLocale($template,'');
			
		return $tdata;
	}
197229
protected function processTableName(Node $tpl) {
    $mapper = self::getMapper($tpl->getType());
    $mapperTableName = $mapper->getRealTableName();

    $tableName = $tpl->getProperty(self::PROPERTY_TABLE_NAME);
    if ($tableName == null) {
      $tableName = $mapperTableName;

      // if the template is the child of another node of the same type,
      // we must use a table alias
      $parents = $tpl->getParentsEx(null, null, $tpl->getType());
      foreach ($parents as $curParent) {
        $curParentTableName = $curParent->getProperty(self::PROPERTY_TABLE_NAME);
        if ($curParentTableName == $tableName) {
          $tableName .= '_'.($this->aliasCounter++);
        }
      }
      // set the table name for later reference
      $tpl->setProperty(self::PROPERTY_TABLE_NAME, $tableName);
    }

    return ['name' => $mapperTableName, 'alias' => $tableName];
  }
597652
public function fetch($tpl_name, &$tpl_source, &$mtime)
	{
		if(file_exists($tpl_name))
		{
			$tpl_source	= ec(file_get_contents($tpl_name));
			$mtime = filemtime($tpl_name);
			return;
		}

		if(($dirs = $this->smarty->getTemplateVars('template_dirnames')))
		{
			foreach($dirs as $dir)
			{
				if(file_exists($fn = str_replace('xfile:', '', $dir)."/".$tpl_name))
				{
					$tpl_source = ec(file_get_contents($fn));
					$mtime = filemtime($fn);
					return;
				}
			}
		}

		foreach($this->smarty->getTemplateDir() as $d)
		{
			if(file_exists($fn = "$d/$tpl_name"))
			{
				$tpl_source = ec(file_get_contents($fn));
				$mtime = filemtime($fn);
				return;
			}
		}

		foreach(bors_dirs(true) as $dir)
		{
			if(file_exists($fn = $dir.'/templates/'.$tpl_name))
			{
				$tpl_source = ec(file_get_contents($fn));
				$mtime = filemtime($fn);
				return;
			}

			if(file_exists($fn = $dir.'/'.$tpl_name))
			{
				$tpl_source = ec(file_get_contents($fn));
				$mtime = filemtime($fn);
				return;
			}
		}

		$tpl_source = NULL;
		$mtime = NULL;
		return;
	}
1334138
function compileTemplate( $tpl, $keyData, $uri, $res, $templatePath, &$extraParameters, &$resourceData )
    {
        $key = $this->cacheKey( $keyData, $res, $templatePath, $extraParameters );
        return eZTemplateCompiler::compileTemplate( $tpl, $key, $resourceData );
    }
657865
public static function showSystemTemplate($tpl)
    {
        $configSubFix = Config::get('html_template_suffix');
        Config::set('html_template_suffix', '');
        echo View::getEngine('html')
            ->setHtmlEngineOptions('templateDir', dirname($tpl) . DIRECTORY_SEPARATOR)
            ->fetch(basename($tpl), false, true, true);
        Config::set('html_template_suffix', $configSubFix);
    }
1181029
public static function display($tpl, $variablesDefinitions = NULL, $indent = NULL) {
    $html = self::get($tpl, $variablesDefinitions, $indent);
    print $html;
  }
75452
private function tpl(): string
    {
        if (interface_exists($this->type)) {
            return 'Return value of %s must implement interface %s, %s returned';
        }

        if (class_exists($this->type)) {
            return 'Return value of %s must be an instance of %s, %s returned';
        }

        if ($this->type == 'callable') {
            return 'Return value of %s must be %s, %s returned';
        }

        return 'Return value of %s must be of the type %s, %s returned';
    }
738017
function (tpl) {
            var func = this.compile(tpl);
            return 'function(' + func.params.join(',') + '){\n' +
                func.source.join('\n') +
                '}';
        }
1171488
public function get($_tpl, $data = array(), $_compiler = null, $_output = false)
    {
        if ($_compiler === null) {
            $_compiler = $this->compiler;
        }

        return parent::get($_tpl, $data, $_compiler, $_output);
    }
145539
public function display($tpl = null)
	{
		$result = $this->loadTemplate($tpl);

		if ($result instanceof Exception)
		{
			return $result;
		}

		echo $result;
	}
108247
function executeCompiledTemplate( $tpl, &$textElements,
                                      $keyData, $uri, $resourceData, $templatePath,
                                      &$extraParameters, $timestamp,
                                      $rootNamespace, $currentNamespace )
    {
        $key = $this->cacheKey( $keyData, $resourceData, $templatePath, $extraParameters );
        return eZTemplateCompiler::executeCompilation( $tpl, $textElements, $key, $resourceData,
                                                       $rootNamespace, $currentNamespace );
    }
892476
public function display($tpl = '')
    {
        $tpl || $tpl = Url::pathInfo();

        if($this->layout){
            self::$content = $this->_getContent($tpl);
            $content = $this->_getContent($this->layout);
        }else
            $content = $this->_getContent($tpl);
        $this->addToken($content);
        headers_sent() || header('Content-Type: text/html; charset=utf-8');
        echo $content;
    }