模板显示 调用内置的模板引擎显示方法，

@param string $templateFile 指定要调用的模板文件 默认为空 由系统自动定位模板文件
@param bool $inOtherApp 是否为载入其它应用的模板

@return void
516957
public function display($templateFile = '', $inOtherApp = false)
    {
        // 网页字符编码
        header('Content-Type:text/html; charset=' . Config::get('default_charset'));
        echo $this->fetch($templateFile, $inOtherApp);
        Cml::cmlStop();
    }
381880
private function validateTemplate($template, $templateList)
    {
        if (empty($template)) {
            throw new \Exception('The template name is required.');
        }

        if (!in_array($template, $templateList)) {
            throw new \InvalidArgumentException(
                sprintf('The template "%s" does not exist, use: %s', $template, implode(', ', $templateList))
            );
        }
    }
264266
private void generate(TemplateFile input, List<OutputFile> outputs, TemplateOptions templateOptions) throws IOException {
    final String targetFileName = targetFileName(templatesPath.relativize(input.path).toString(), templateOptions);
    final OutputFile output = new OutputFile(outputPath.resolve(targetFileName).toAbsolutePath().normalize());

    if (incremental &&
        Files.exists(output.path) &&
        Files.getLastModifiedTime(output.path).toMillis() >= Files.getLastModifiedTime(input.path).toMillis()) {
      // No need to re-render but mark as generated.
      output.upToDate = true;
      outputs.add(output);
      return;
    }

    String template = new String(Files.readAllBytes(input.path), StandardCharsets.UTF_8);

    timeVelocity.start();
    template = filterVelocity(input, template, templateOptions);
    timeVelocity.stop();

    // Check if template requested ignoring a given type combination.
    if (templateOptions.isIgnored()) {
      return;
    }

    getLog().debug("Processing: " + input.getFileName() + " => " + output.path);
    try {
      timeIntrinsics.start();
      template = filterIntrinsics(template, templateOptions);
      timeIntrinsics.stop();
  
      timeComments.start();
      template = filterComments(template);
      timeComments.stop();
  
      timeTypeClassRefs.start();
      template = filterTypeClassRefs(template, templateOptions);
      template = filterStaticTokens(template, templateOptions);
      timeTypeClassRefs.stop();
    } catch (RuntimeException e) {
      getLog().error("Error processing: " + input.getFileName() + " => " + output.path + ":\n\t" + e.getMessage());
      throw e;
    }

    Files.createDirectories(output.path.getParent());
    Files.write(output.path, template.getBytes(StandardCharsets.UTF_8));

    outputs.add(output);
  }
10794
public function setTemplateMap(array $templateMap)
    {
        $this->templateMap = [];
        foreach ($templateMap as $name => $filename) {
            $this->addTemplate($name, $filename);
        }
    }
1254762
public function render($templateFile, array $vars = [])
    {
        $this->getService('retriever')->setLocalVars($vars);
        return $this->getService('template')->render($templateFile, $vars);
    }
510208
public function setTemplateFile(string $sRelativePathToFile) : void
  {
    if(!is_file($sRelativePathToFile)) {
      throw new \Exception('Template file not found.');
    }
    
    $sFileContent = file_get_contents($sRelativePathToFile);
    $this->setTemplate($sFileContent);
  }
1078229
public function fetch($templateFile,$var) {
        $templateFile=substr($templateFile,strlen(THEME_PATH));
        $var['_think_template_path']=$templateFile;
        exit(json_encode($var));	
    }
1157277
public function display($templateFile='',$charset='',$contentType='',$content='',$prefix='') {
        G('viewStartTime');
        // 视图开始标签
        Hook::listen('view_begin',$templateFile);
        // 解析并获取模板内容
        $content = $this->fetch($templateFile,$content,$prefix);
        // 输出模板内容
        $this->render($content,$charset,$contentType);
        // 视图结束标签
        Hook::listen('view_end');
    }
1009324
public function generateFile($filename, $templateData, $templatePath = null)
    {
        $this->makeDirectory($this->rootPath);

        $path = $this->rootPath.$filename;

        if (is_null($templatePath)) {
            $templatePath = $this->templatePath;
        }
        
        $content = $this->generateContent($templatePath, $templateData);

        if (! file_exists($path)) {
            $this->fileHelper->put($path, $content);
            $this->command->info($filename.' created successfully.');
        } else {
            $this->command->info($filename.' already exists ... skipping.');
        }
    }
1231421
public function readTemplate($templatePath)
    {
        if(!is_readable($templatePath)) {
            throw new Exception("No permissons to read template: ".$templatePath);
        }
        if($templateData = file_get_contents($templatePath)) {
            return $templateData;
        }
        else {
            throw new Exception("Can not read template: ".$templatePath);
        }
    }
482332
protected function display($templateFile='',$charset='',$contentType='',$content='',$prefix='') {
        $this->view->display($templateFile,$charset,$contentType,$content,$prefix);
    }
802947
private String generateContent(String templateFile) {
		try {
			GStringTemplateEngine gStringEngine = new GStringTemplateEngine();
			URL url = loadTemplate(templateFolder + "/" + templateFile);
			if (url == null) {
				logWarn("NO TEMPLATE FOUND FOR " + templateFile);
			} else {
				logDebug("Loaded template: " + url.getPath());
			}
			if (url == null) return null;
			
			Template template = gStringEngine.createTemplate(url);
			return template.make(modelMap).toString();
		} catch (Exception e) {
			ps.println("### ERROR: Failed generate templatefile: " + templateFile);
			e.printStackTrace(ps);
			return null;
		}
	}
566340
protected function validateTemplate($template_file)
    {
        $is_valid = false;

        if (!$template_file instanceof \SplFileInfo) {
            $template_file = new \SplFileInfo($template_file);
        }

        // Is this a routable template?
        if (
            $template_file->isFile() &&
            $template_file->isReadable() &&
            ('html' === $template_file->getExtension())
        ) {
            $is_valid = true;
        }

        return($is_valid);
    }
1176466
protected function executeCache(IoInterface $inOut, ContainerInterface $container): void
    {
        /** @var TemplatesCacheInterface $cache */
        $cache = $container->get(TemplatesCacheInterface::class);

        $settings  = $this->getTemplatesSettings($container);
        $templates = $settings[TemplatesSettings::KEY_TEMPLATES_LIST];

        foreach ($templates as $templateName) {
            // it will write template to cache
            $inOut->writeInfo(
                "Starting template caching for `$templateName`..." . PHP_EOL,
                IoInterface::VERBOSITY_VERBOSE
            );

            $cache->cache($templateName);

            $inOut->writeInfo(
                "Template caching finished for `$templateName`." . PHP_EOL,
                IoInterface::VERBOSITY_NORMAL
            );
        }
    }
72483
public function init(string $templatesPath, string $cachePath = null) : TemplateLoaderInterface
    {
        $loader = new \Twig_Loader_Filesystem($templatesPath);
        if (null !== $cachePath) {
            $this->env = new \Twig_Environment($loader, [
                'cache' => $cachePath,
            ]);
        } else {
            $this->env = new \Twig_Environment($loader);
        }
        return $this;
    }
1333070
protected function buildHtml($htmlfile='',$htmlpath='',$templateFile='') {
        $content    =   $this->fetch($templateFile);
        $htmlpath   =   !empty($htmlpath)?$htmlpath:HTML_PATH;
        $htmlfile   =   $htmlpath.$htmlfile.C('HTML_FILE_SUFFIX');
        Storage::put($htmlfile,$content,'html');
        return $content;
    }
1262709
private function _setContentFromFile() {
		
		// empty original template content
		$this->setContent('');
		
		// check for template file and load it
		if ($filename = $this->getTemplate()) {
			if (file_exists($filename)) {
				$content = trim(file_get_contents($this->_filename));
				$this->setContent($content);
			}
		}
	}