当前位置: 首页>>代码示例>>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;未经允许,请勿转载。