Keywords: Openads, adverts, separate ads in different forums, forum ads, discussion module banner ads
Problem: The discussion module works off of one main template, theme_global.php in the forum themes directory.
A user who wishes to place general google ads or rotating ads from a program or script can usually simply insert the Javascript banner ad code in certain places, most likely:
1. In the page sub-header (for top banner)
and
2. In the HTML footer - near the bottom of that code before the last body (end) tag.
But neither of these solve the problem of placing different ads in different forums! For instance, if you have a site on remodeling, and have three forums:
A. Roofing
B. Electrical
C. Plumbing
It would be nice to be able to offer ad programs to your sponsors in their targeted forums. That would give you more inventory to “sell”, and also keep the sponsor happier.
Here is the solution that I hacked together for beginners. Please feel free to improve or add to this and/or email me.
This solution is only for the BOTTOM of the pages, as it was not tested at the top and I don’t think it will work, although further hacking may help it. The problem is that this grabs a hidden form in the forum page which may not yet exist when the top loads.
Ok, so without further ado….this needs to be between Javascript tags.
———————————————————
sponsor = document.forms[2].forum_id.value;
[removed](sponsor);
function staticLoadScript(url)
{
[removed](’<\/script>’);
}
staticLoadScript(“http://www.hearth.com/cgi-bin/gold” + sponsor + ‘.’ + “pl?jscript”);
—————————————————————
note - line 2 can be removed as it simply displays the forum number so you can check your work…..
How it works:
The first line is JS which gets the value of forum_id out of a hidden field in the 2nd form (in the html source) of the page. That is the forum number - like 1, 22, etc.
Then the function places that into a URL string which calls the banner program on your server. In my case, I use Adverts, which allows me to simply call a separate copy of the ad serving script named:
http://www.hearth.com/cgi-bin/gold22.pl?jscript
See the forum name appended to the end of the script name? That is the key to the city.
For an example, see the forum discussing Pellet Stoves on my site:
http://www.hearth.com/econtent/index.php/forums/viewforum/22/
Notice that a pellet banner loads up - I also left the forum number there just for an example…..
