當前位置: 首頁>>代碼示例>>PHP>>正文


PHP BackendTemplate::getCompileDirectory方法代碼示例

本文整理匯總了PHP中BackendTemplate::getCompileDirectory方法的典型用法代碼示例。如果您正苦於以下問題:PHP BackendTemplate::getCompileDirectory方法的具體用法?PHP BackendTemplate::getCompileDirectory怎麽用?PHP BackendTemplate::getCompileDirectory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在BackendTemplate的用法示例。


在下文中一共展示了BackendTemplate::getCompileDirectory方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: parse

 /**
  * Parse the JS, CSS files and meta-info into the head of the HTML-document
  */
 public function parse()
 {
     $cssFiles = array();
     $jsFiles = array();
     // get last modified time for the header template
     $lastModifiedTime = @filemtime($this->tpl->getCompileDirectory() . '/' . md5(realpath(BACKEND_CORE_PATH . '/layout/templates/header.tpl')) . '_header.tpl.php');
     // reset lastmodified time if needed (SPOON_DEBUG is enabled or we don't get a decent timestamp)
     if ($lastModifiedTime === false || SPOON_DEBUG) {
         $lastModifiedTime = time();
     }
     // if there aren't any CSS-files added we don't need to do something
     if (!empty($this->cssFiles)) {
         // loop the CSS-files and add the modified-time
         foreach ($this->cssFiles as $file) {
             // add lastmodified time
             if ($file['add_timestamp'] !== false) {
                 $file['path'] .= strpos($file['path'], '?') !== false ? '&m=' . $lastModifiedTime : '?m=' . $lastModifiedTime;
             }
             // add
             $cssFiles[] = array('path' => $file['path']);
         }
     }
     // assign CSS-files
     $this->tpl->assign('cssFiles', $cssFiles);
     // if there aren't any JS-files added we don't need to do something
     if (!empty($this->jsFiles)) {
         // some files should be cached, even if we don't want cached (mostly libraries)
         $ignoreCache = array('/backend/core/js/jquery/jquery.js', '/backend/core/js/jquery/jquery.ui.js', '/backend/core/js/ckeditor/jquery.ui.dialog.patch.js', '/backend/core/js/jquery/jquery.tools.js', '/backend/core/js/jquery/jquery.backend.js', '/backend/core/js/ckeditor/ckeditor.js', '/backend/core/js/ckeditor/adapters/jquery.js', '/backend/core/js/ckfinder/ckfinder.js');
         foreach ($this->jsFiles as $file) {
             // some files shouldn't be uncachable
             if (in_array($file['path'], $ignoreCache) || $file['add_timestamp'] === false) {
                 $jsFiles[] = array('path' => $file['path']);
             } else {
                 // if the file is processed by PHP we don't want any caching
                 if (substr($file['path'], 0, 11) == '/backend/js') {
                     $jsFiles[] = array('path' => $file['path'] . '&m=' . time());
                 } else {
                     if (strpos($file['path'], '?') !== false) {
                         $path = $file['path'] . '&m=' . $lastModifiedTime;
                     } else {
                         $path = $file['path'] . '?m=' . $lastModifiedTime;
                     }
                     $jsFiles[] = array('path' => $path);
                 }
             }
         }
     }
     // assign JS-files
     $this->tpl->assign('jsFiles', $jsFiles);
 }
開發者ID:naujasdizainas,項目名稱:forkcms,代碼行數:53,代碼來源:header.php


注:本文中的BackendTemplate::getCompileDirectory方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。