I have a clean install of the banner module in Drupal 4.6.2.
Everything appears to be working on the admin side of things (add, edit, preview banners) but the banners don't show up in my Ad block. Script code looks a little suspicious when I view source using & in the URL instead of & - but I am not sure what to do to fix this.

http://www.batterhead.com = ad shoud be in the advertisement block on the right

thanks,
b

CommentFileSizeAuthor
#3 banner_db_fix_nexted_arrays.patch1.13 KBpfaocle

Comments

batterhead’s picture

Priority: Critical » Normal

I modified banners.module to change the & to & - that did not seem to work. I added a new banner and that one woked using a very clean and simple URL (the other is a linkshare URL). So... then I modified the banner that was now working to use the linkshare URL and that worked... so I deleted the first banner I made and now all seems fine. No clue why it did not work the first time. *shrug*

smunt’s picture

I'm having the same problem.

Drupal version: 4.6.5
PHP version: 4.3.10

It works with this patch though:

--- banner_db.orig.php 2006-01-05 12:13:11.000000000 +0100
+++ banner_db.new.php 2006-01-05 12:13:14.000000000 +0100
@@ -8,15 +8,15 @@
include_once "includes/common.inc";
list($ballot, $banners) = _banner_get_struct();

- $max = count($ballot[$pos]) - 1;
+ $max = count($ballot[0][$pos]) - 1;
if ($max > 0) {
$random = mt_rand(0, $max);
}
else {
$random = 0;
}
- $id = $ballot[$pos][$random];
- $banner = $banners[$id];
+ $id = $ballot[0][$pos][$random];
+ $banner = $banners[0][$id];

$banner->views++;

Or download my version from: http://qux.nl/banner_db.php.txt

pfaocle’s picture

Status: Active » Needs review
StatusFileSize
new1.13 KB

Confirmed, this patch works for me, with the latest HEAD checkout (NOT the latest bundled 4.6.0 version, which doesn't seem to work at all).

__Tango’s picture

You don't want to hardcode [0] because that's the tid.

You should pick out the $tid from the request. Here's a diff (also described in http://drupal.org/node/36805).

RCS file: /cvs/drupal/contributions/modules/banner/banner_db.php,v
retrieving revision 1.10
diff -u -r1.10 banner_db.php
--- banner_db.php       19 Apr 2005 12:57:42 -0000      1.10
+++ banner_db.php       25 Jan 2006 06:27:41 -0000
@@ -3,20 +3,22 @@
   header("content-type: application/x-javascript");

   $pos = (int)$_GET["pos"];
+  $tid = (int)$_GET["tid"];

   include_once "includes/bootstrap.inc";
   include_once "includes/common.inc";
   list($ballot, $banners) = _banner_get_struct();

-  $max = count($ballot[$pos]) - 1;
+  $max = count($ballot[$tid][$pos]) - 1;
   if ($max > 0) {
     $random = mt_rand(0, $max);
   }
   else {
     $random = 0;
   }
-  $id = $ballot[$pos][$random];
-  $banner = $banners[$id];
+  $id = $ballot[$tid][$pos][$random];
+  $banner = $banners[$tid][$id];

   $banner->views++;
igrcic’s picture

yes, when i make a patch banner shows up! but they are not rotating! only first banner on list is showing up!! anybody else can confirm that they are rotating?

igrcic’s picture

It ok, works now! messed up something :(

hexenxp05@drupal.org.es’s picture

Good Work It!
Funciono... jaja

pfaocle’s picture

Status: Needs review » Needs work
wulff’s picture

Status: Needs work » Fixed

Slightly modified version committed. Thanks!

Anonymous’s picture

Status: Fixed » Closed (fixed)