Advertisement
Smartik

All Sliders Revolution in an array - "alias => title"

Mar 13th, 2013
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.58 KB | None | 0 0
  1. <?php
  2.     //Create a function to get all available sliders in an array: "alias => title"
  3.     function all_rev_sliders_in_array(){
  4.         if (class_exists('RevSlider')) {
  5.             $theslider  = new RevSlider();
  6.             $arrSliders = $theslider->getArrSliders();
  7.             $arrA   = array();
  8.             $arrT   = array();
  9.             foreach($arrSliders as $slider){
  10.                 $arrA[]     = $slider->getAlias();
  11.                 $arrT[]     = $slider->getTitle();
  12.             }
  13.             $result = array_combine($arrA, $arrT);
  14.             return $result;
  15.         }
  16.     }
  17.    
  18.     //OK, show me what is there!
  19.     echo '<pre>';
  20.     print_r ( all_rev_sliders_in_array() );
  21.     echo '</pre>';
  22. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement