示例#1
0
 /**
  * Compile a string if necessary
  *
  * @param string $string: RainTpl template string to compile
  *
  * @return string: full filepath that php must use to include
  */
 protected function checkString($string)
 {
     // set filename
     $templateName = md5($string . implode($this->config['checksum']));
     $parsedTemplateFilepath = $this->config['cache_dir'] . $templateName . '.s.rtpl.php';
     $templateFilepath = '';
     $templateBasedir = '';
     // Compile the template if the original has been updated
     if ($this->config['debug'] || !file_exists($parsedTemplateFilepath)) {
         $parser = new Tpl\Parser($this->config, static::$plugins, static::$registered_tags);
         $parser->compileString($templateName, $templateBasedir, $templateFilepath, $parsedTemplateFilepath, $string);
     }
     return $parsedTemplateFilepath;
 }