Banner displaying correctly in block but not in theme
ymcp - October 13, 2006 - 08:01
| Project: | Banner |
| Version: | 4.7.x-1.x-dev |
| Component: | Documentation |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
With Drupal 4.7.3 and the latest (v1.70.2.7) Banner 4.7 module, I have a banner correctly displaying in the footer block. However, it does not display in the theme.
I edited my theme's page.tpl.php file & added "print banner_display(1, 1)" as per the INSTALL.txt instructions, but it doesn't appear.
I had this working correctly with a slightly older CVS version of the banner module (v1.66), so assume that this is a bug in the current 4.7 version. Perhaps I should just use the most recent CVS version for now?
Does anybody have the current 4.7 banner module working within a theme?

#1
Mmmm... this problem also affects the current CVS version (v1.70).
After checking the code for this module & doing some testing, I found the answer: the first parameter to the banner_display() function needs to be the term_id of the banner group, not the banner group number!!!. I don't think that the documentation makes this at all clear.
So, what you need to do is go to: administer -> categories -> banner groups -> list terms, then hover your mouse pointer over the "edit" link of the group you want to display & see what the URL is. You need the part that goes "...edit/term/XXX?destination=..." where XXX is the term id. In my case XXX=157.
Then, in your page.tpl.php file use this: "print banner_display(157,1);" (With the required php tags etc).
In the older versions of the banner module you could get away with just using "banner_display()", ie without any parameters, becuase the function's default values resulted in one banner from group "0" being displayed. The current situation where you need to hard-code the term_id into your theme seems a backwards step.
My suggestion would be to either (1) make the banner_display() function use the group number rather than term_id as the first parameter, or (2) add some notes to the INSTALL.txt file that you need to use the term_id. I am happy to provide the text for (2), but my Drupal/php skills probably aren't up to doing (1) myself.
Anyway, I still think that this is a really useful module & appreciate all the work that has gone into it. Hopefully this change can be made to help anybody else having the same difficulty that I have had.
#2
I updated the documentation at http://drupal.org/node/51721 to reflect that in 4.7 you now create banner nodes and assign them to a taxonomy term. I also re-categorized http://drupal.org/node/51718 but that particular page still holds true for the 4.6 version.
The INSTALL.txt file still needs significant editing, however.
#3
Ohh man, thanks a lot. I was pulling hair out all day trying to figure out why it wasn't showing, even calling it with the function. Thought it could've been my MIME types, etc. Yeah I wish people would update the documentation with the modules. Thanks again!
#4
Here's the patch updating installation instructions.
#5
Will be fixed in next commit of 4.7/5.0. Thanks.
#6