Example #1
0
File: jssor.php Project: rair/yacs
 /**
  * Load jssor libs 
  * 
  * @global array $context
  * @param boolean $withCSS option to load defaut CSS for jssor slider
  */
 public static function Load($withCSS = true)
 {
     global $context;
     // note : we assume jquery is loaded
     if (isset($context['with_debug']) && $context['with_debug'] === 'Y') {
         Page::defer_script('included/jssor/js/jssor.js');
         Page::defer_script('included/jssor/js/jssor.slider.js');
     } else {
         // contains both dev files minified
         Page::defer_script('included/jssor/js/jssor.slider.mini.js');
     }
     if ($withCSS) {
         Page::load_style('included/jssor/jssor.css');
     }
 }
Example #2
0
 /**
  * Load in current page style sheets and javascript
  * files binded with the overlay.
  *
  * Filenames must be same as classname, plus extension.
  *
  * Usage :  $this->load_scripts_n_styles();
  * within parts of your overlay witch need those dependancies.
  * (render(), get_view_text() ... )
  *
  * Note the function will also call dependancies of parent class.
  *
  * @param type $myclass, argument used by the recursive call.
  */
 protected final function load_scripts_n_styles($myclass = '')
 {
     // fuse not to search twice for bound files
     static $fuse_called = false;
     // function is always called by DEV without specifying the class.
     // fuse should not block recursive calls from the firt call,
     // which are always done with a classname argument
     if (!$myclass && $fuse_called) {
         return;
     }
     $fuse_called = true;
     if (!$myclass) {
         $myclass = get_class($this);
     }
     $parent = get_parent_class($myclass);
     // load scripts (if exist)
     Page::load_style(strtolower('overlays/' . $myclass . '/' . $myclass . '.css'));
     Page::defer_script(strtolower('overlays/' . $myclass . '/' . $myclass . '.js'));
     // recursive call to parent class, stop on "Overlay"
     if ($parent != '' && $parent != 'Overlay') {
         $parent::load_scripts_n_styles($parent);
     }
 }