Exemple #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';
     // Compile the template if the original has been updated
     if ($this->config['debug'] || !file_exists($parsedTemplateFilepath)) {
         $parser = new Tpl\Parser($this);
         $parser->compileString($templateName, $parsedTemplateFilepath, $string);
     }
     return $parsedTemplateFilepath;
 }
Exemple #2
0
 /**
  * Compile a string if necessary
  *
  * @param string $string RainTpl template string to compile
  *
  * @event engine.checkString $string
  * @return string full filepath that php must use to include
  */
 protected function checkString($string)
 {
     $string = $this->executeEvent('engine.checkString', $string);
     // set filename
     $templateName = md5($string . implode($this->getConfigurationKey('checksum')));
     $parsedTemplateFilepath = $this->getConfigurationKey('cache_dir') . $templateName . '.s.rtpl.php';
     // Compile the template if the original has been updated
     if ($this->getConfigurationKey('debug') || !file_exists($parsedTemplateFilepath)) {
         $parser = new Tpl\Parser($this);
         $parser->compileString($templateName, $parsedTemplateFilepath, $string);
     }
     return $parsedTemplateFilepath;
 }