silly Banner.module path issue

Submitted by jwells
on July 9, 2005 - 8:54pm

Druapl 4.6.2

Hi Jeremy,
I was going to make this short, but figured I better type it all out instead. to see if there was a bad step i did

Installed banner.module like all other modules, but when i couldn't get it work - decided I better read the install me file... duh :-)

So I then unchecked, all related settings and access checkboxes. Uploaded banner.module into /modules, instead of /modules/banner and unloaded the two other files (file and db) into the root /. and deleted copies in wrong locations. enabled correct location versions.

Still getting "Failed to access "banner_file.php", file does not exist. Unable to display banners.'

Changed permissions on the two files (file and db) from 666 to 755 - no go - changed to 777 - no go. grrr...

went to sql and deleted proper banner table, reloaded and installed properly. no go - changed to 777 - no go, went to WebShell to confirm attributes were really changed... yep.

Read instructions again, what did i miss??

searched through other Drupal tables to see if some banner path info was saved to some other table I didn't know about and needed to flush out from first bad install. nope

then called 1-800-Help-Jeremy :-)

this is so silly, but I must not be seeing something

can you help? I saw another post regarding this issue on goggle, but the link went to drupal.org or course, so that's not going to help today.

one other thing...

I'm running a multisite with the proper settings in /sites, per drupal install doc. see no problems there - but mention only as complete info

thanks

easiest fix

on
July 9, 2005 - 9:08pm

The easiest fix is to install the cvs version of the module. You will need to do a complete new re-install, as I've made some large changes. The cvs version currently works with Drupal 4.6.x.

As drupal.org is down, grab the latest version here. (this link is temporary, I will remove it soon...)

thanks for posting the cvs ve

on
July 10, 2005 - 1:13am

thanks for posting the cvs version.

i'm still getting a few errors

1) had to change the bottom of the CREATE TABLE routine to

) TYPE=MyISAM;

I don't have a clue what this does - but was getting line 1 errors until I changed it. I knew line 1 was ok, so it had to be the close. if what I did was wrong PLEASE advise - had to do it on both CREATE TABLES - i got the code from a different module - l,ike i said don't have a clue what it means.

it seems to be working will upload banner for a test - do you know off-hand which themes are banner ready?

PS: there is a new post at the .org we were discussing. By looking at posts and files avail for download, leave me to lean towards #3 in the Pmsg sent to you - of the possible reasons.

it's working! I followed t

on
July 10, 2005 - 1:36am

it's working!

I followed the instructions to the word.

Nice, not having to mess with theme .. thanks :-) Also like the "group" idea very much - cleaver.

I have to figure out how to get a block into the header area... much like what you have done. No problem figuring out the 1st or 3rd column stuff.I've never placed a block anywhere else besides right or left columns.

If you have any notes - on how to place a block somewhere, besides the right or left columns, it would most helpful.

thanks again,
Jeff

> I have to figure out how to

on
July 10, 2005 - 1:41am

> I have to figure out how to get a block into the header
> area... much like what you have done.

Unfortunately at this time Drupal only has a concept of putting blocks in columns to the left and to the right. The banner ad you see in the header here on KernelTrap is displayed by modifying the theme.

I think I read something on drupal-devel that the ability to put blocks in other regions (ie header and footer) is being worked on for 4.7 or later.

answers

on
July 10, 2005 - 1:38am

> if what I did was wrong PLEASE advise

Your change is fine.

> do you know off-hand which themes are banner ready?

None that I know of. Themes have to be patched to work with the banner module. Take a look at the included example patch (contributed/theme/xtemplate.patch) for ideas on how to do so.

(Or put your ads in blocks -- this does not require a patch to the theme. For example, see the text ad in the upper right hand corner of KernelTrap, beneath the search button.)

> leave me to lean towards #3

My understanding is that their ISP did an upgrade that broke the site.

i forgot to ask... where deos

on
July 10, 2005 - 1:45am

i forgot to ask... where deos the .pot file go?

I'm not sure what it does

thanks again Jeremy

.pot file

on
July 10, 2005 - 1:52am

The .pot file is used for translating the module into other languages. (The included .pot file is probably way out of date.) It can safely be deleted.

picked up two new small errors

on
July 11, 2005 - 3:13am

Drupal 4.6.2 multisite

Hi,
picked up two new errors tonight.

warning: Invalid argument supplied for foreach() in ~/modules/banner.module on line 1258.

warning: sort() expects parameter 1 to be array, null given in ~/modules/banner.module on line 1266.

Details:
1) running one vert banner in top right column - all pages - have two banners loaded - one vert and one horz. not using horz. yet - vert banner assigned to group 1. Horz assigned to group 0.

2) get error when clicking on the display partial content of node on front page and then, ie ... take me to the full book page - click on header link or read more, same error result

3) banner will display even with error

4) Banner display counts working perfect

5) back to home page - error gone

any suggestions?

thanks

patch

on
July 11, 2005 - 8:57am

Can you try this patch and tell me if it solves your problem?

That did it!... thanks :-)

on
July 11, 2005 - 10:38am

That did it!... thanks :-)

By the look of the incredible depth of this site and your level of knowledge on systems, I’m thinking you might be the person to ask a question; I’ve been pondering for awhile. I don’t know enough about code or systems to know this, so please don’t read any sarcasm into it… as there is zero, just a sincere desire to understand.

Why is it that the same code on machine A verses machine B, can produce errors on one machine yet not on the other machine? It goes beyond standard logic for me. There is another module I’ve been trying to use and I keep getting the error “scalar value as an array” and yet we are both using PHP 4.3.11 and the same version of Drupal and his module is working perfect and everyone else’s module is working perfect as well. Yet, mine has two flat tires and is stuck in the mud? I see this issues often enought to ponder it. I’m trying to understand it, but just don’t have the knowledge yet. If it’s too complex to explain, no to worry, I wouldn’t be offended.

Thanks again for the patch…

configuration

on
July 11, 2005 - 11:54am

In the case of the banner module (which the above patch fixed), it was due to a difference in configuration. Essentially, I didn't take into account a case in which a banner was configured for a certain taxonomy type, but wasn't enabled.

Perhaps this is true for the other instance that you're talking about, something is configured differently, and in your configuration it is triggering an error...?

sorry, probably being a pest

on
July 11, 2005 - 10:26pm

Sorry Jermey, don't mean to be a pest... but :-)

! just did a commission junction test, complex link info - text file - works great

? in the blocks create... can banners be stacked in the same block?

example:

return banner_display(1);
return banner_display(2);

Reason:
using pushbutton theme and it likes to add an icon header for every new block - just trying to make it look a bit cleaner. Also the reason I opened up group two, was size difference in banners, short verses long size

thanks agan for a great program! ... running solid

> can banners be stacked in t

on
July 11, 2005 - 10:35pm

> can banners be stacked in the same block?

Why not? Are you having problems with it? It is a PHP block, so you can output any PHP code you like, including multiple calls to banner_display()...

I thought so

on
July 11, 2005 - 11:12pm

I thought so.

I have the open and close php stuff - just didn't post it here, not sure how to post code and make it look like text and not code.

then I add a ; behind each line ... wrong sytax? - like above example

thanks

installed CVS version

kaparo (not verified)
on
July 14, 2005 - 8:56am

Hi Jeremy,

First, many thanks for the great module. Seems it fits all my need.

I installed the cvs version of banner module, against 4.6.2. Everything is fine. I set up properly the terms and vocabulary for the banners. However the banners are not shown up occasionally. I refreshed the cache. Deleting manually the ".x.banner.cache" files sometime helped.

The error message is:

Cannot modify header information - headers already sent by (output started at c:\protools\banner_file.php:35) in c:\protools\includes\common.inc on line 99.

The banner_file.php and banner_db.php are in the drupal's root. And the testbed machine is under Windows, so there are not any file permissions problems.

Could you check these problems please?

Regards,
kaparo

drupal.org

on
July 14, 2005 - 9:24am

Drupal.org is back up, please raise banner issues there.

BTW: In your bug report, it would be helpful to try and figure out what text is being generated. ie, is fread() spitting an error to the screen?

Hi, no, the block which co

kaparo (not verified)
on
July 14, 2005 - 10:50am

Hi,

no, the block which contains just is blank. The line 35 is

$contents = fread($fd, filesize($cache_file));

I've added an issue in drupal. It is up and down these days quite often

kaparo

Fixed some bugs in banner_db.php

Andrew Wilcox (not verified)
on
December 8, 2005 - 2:54pm

'tid' wasn't include in the array structures.

<?php
// $Id: banner_db.php,v 1.10 2005/04/19 12:57:42 jeremy Exp $

    header("content-type: application/x-javascript");

    $tid = (int)$_GET['tid'];
    $pos = (int)$_GET['pos'];

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

    $max = count($ballot[$tid][$pos]) - 1;
    if ($max > 0) {

      $random = mt_rand(0, $max);

    }
    else {

      $random = 0;

    }
    $id = $ballot[$tid][$pos][$random];
    $banner = $banners[$tid][$id];

    $banner->views++;

    db_query("UPDATE {banner} SET views = views + 1, day_views = day_views + 1, week_views = week_views + 1 WHERE id = %d", $id);

    if ($banner->max_views > 0 && $banner->views >= $banner->max_views) {

      // reached maximum views, set status (5) "blocked"
      db_query("UPDATE {banner} SET status = 5 WHERE id = %d", $id);

    }
    else if ($banner->day_max_views > 0 && $banner->day_views >= $banner->day_max_views) {

      // reached day's maximum views, set status (2) "day's limit reached"
      db_query("UPDATE {banner} SET status = 2 WHERE id = %d", $id);

    }
    else if ($banner->week_max_views > 0 && $banner->week_views >= $banner->week_max_views) {

      // reached week's maximum views, set status (3) "week's limit reached"
      db_query("UPDATE {banner} SET status = 3 WHERE id = %d", $id);

    }

    echo $banner->html;

?>

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.