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


PHP javascript::scriptPaths方法代碼示例

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


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

示例1: renderLinks

 public static function renderLinks($inline = FALSE, $index = FALSE)
 {
     // build a var with the included css files
     $scriptincludes = self::$scriptPaths;
     self::$scriptPaths = array();
     // Get the session so we can track what assets are on the page
     $session = Session::instance();
     // If this is a full page load (ie not ajax) then there are no assest already on page
     if (!request::is_ajax()) {
         $session->delete('javascript.onPageAssets');
     }
     // Initialize the vars to track what has been added, and convience wrappers
     $onPageAssets = $session->get('javascript.onPageAssets', array());
     // sort the script include paths by weight
     ksort($scriptincludes);
     // loop all the script includes and determine what needs to go on this page
     // and in what order
     $includes = array();
     foreach ($scriptincludes as $scripts) {
         // make sure there are no duplicates in this array
         $scripts = array_unique($scripts);
         // make sure these css links are not already on the page
         // via ajax/parent or in another weight category (lowest weight wins)
         $scripts = array_diff($scripts, $onPageAssets);
         // add the filtered list to the array of assets to put on the page
         $includes = array_merge($includes, $scripts);
         // keep track of what we add to the pages
         $onPageAssets = array_merge($onPageAssets, $scripts);
     }
     // NOTICE: setting $session here causes segfault during ajax
     // made a hack to move this set outside the event .....
     Bluebox_Controller::$onPageAssets['js'] = $onPageAssets;
     //$session->set('javascript.onPageAssets', $onPageAssets);
     // create a list of links from the script includes
     $linkList = html::script($includes, $index);
     // are we displaying this inline or returning the string
     if ($inline) {
         echo $linkList;
     } else {
         return $linkList;
     }
 }
開發者ID:swk,項目名稱:bluebox,代碼行數:42,代碼來源:javascript.php


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