Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div class= "ads">
- <?php
- //add all existing and new ad numbers to the list//
- $ad_number_list = array( 0, 2, 4,45, 67, 23, 222 );
- //enter the number of ads to show in the sidebar//
- $show_ads = 3;
- $max_no = count($ad_number_list)-1;
- $numbers = array(); $old = array();
- $end = min( $show_ads, $max_no+1 ); //just in case there are less ads than spaces
- if(function_exists('mba_display_banner')) :
- //generate some unique array indices//
- for( $i=1; $i<=$end; $i++) :
- $old = $numbers;
- do { $numbers[$i] = (int)rand(0,$max_no); } while ( in_array($numbers[$i], $old) );
- endfor;
- //call the random unique ads
- for( $i=1; $i<=$end; $i++) :
- $ad_no = $ad_number_list[$numbers[$i]];
- mba_display_banner($ad_no);
- endfor;
- endif; ?>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement