コード例 #1
0
ファイル: Compiler.php プロジェクト: laiello/phpdays
 /**
  * Save compiled template in file.
  *
  * @param string $templateName Path to template file (start from template dir)
  * @param string $sData Saved data to cache
  * @return bool
  */
 private static function _setCompile($templateName, $sData)
 {
     // full path to template
     $sCompilePath = Templum::getCompileDir() . $templateName;
     $sTemplatePath = Templum::getTemplateDir() . $templateName;
     // create directory hierarhy
     $sDirs = dirname($sCompilePath);
     if (!is_dir($sDirs)) {
         mkdir($sDirs, 0755, true);
     }
     // save cache
     $oFile = file_put_contents($sCompilePath, $sData);
     // set cache modification time
     $iDate = filemtime($sTemplatePath);
     touch($sCompilePath, $iDate);
 }