I wanted to show more banners in a block instead of just one. I downloaded the module on 2006-11-23 from http://www.ratatosk.net/software/banner/files/banner-rc1.tar.gz (INSTALL.txt shows $Id: INSTALL,v 1.14 2006/04/13 15:14:48 wulff Exp $). It didn't use the count parameter in the file banner_db.php at all, so I added a few lines to take advantage of it.
Here are the lines I added (denoted by rseiser):

$count = $_GET['count']; //rseiser: count of banners within block
:
:
$random_numbers_used=array(); //rseiser: start with array where no banners were chosen yet
for($i_banner=0;$i_banner<$count;$i_banner++) { //rseiser: number of banners in this banner block
// choose random banner
do { //rseiser
if ($max > 0) {
$random = mt_rand(0, $max);
}
else {
$random = 0;
}
} while(in_array($random, $random_numbers_used) && count($random_numbers_used)-1<$max); //rseiser: we break the loop if 
//rseiser: a) either a banner is found that was not used yet
//rseiser: b) or the maximum number of banners was already used up. The chosen one will just be used another time.
$random_numbers_used[] = $random; //rseiser: adds the chosen banner index to an array to avoid getting duplicate banners within block
:
:
:
print $banner->cache;
} //rseiser: repeat for next banner $i_banner
?>

Comments

rseiser’s picture

Status: Active » Fixed

It looks like it is already solved in a similar way in in the newer version in the CVS (banner_db.php rev. 1.24)(http://cvs.drupal.org/viewcvs/drupal/contributions/modules/banner/). I previously used the test version recommended in http://drupal.org/node/66063.

Anonymous’s picture

Status: Fixed » Closed (fixed)