Version: , by (Guest)
Developer Last Online: Jan 1970
Version: 2.0.x
Rating:
Released: 06-20-2001
Last Update: Never
Installs: 19
No support by the author.
Giving back some more ...
We have 30+ forums, all dedicated to different topics. I wanted to be able to sell targeted banner ads for each of those categories. phpAdsNew is great for serving ads, but I needed to make some quick changes to VB in order to facilitate targeting.
Its easy to just plop in a generic call to phpAdsNew in the "header" template - works easy enough - however, you have no control and no ability to dynamically target those ads to a given forum. Now you can. (If there is another way, someone please tell me).
This is a simple hack, which involves a quick change to "global.php".
In global.php, find:
Code:
// figure out the chosen style settings
Below that, add:
Code:
// figure out the chosen style settings
// BSB - HACK - Need to populate foruminfo for targeted ads
if(isset($forumid)) {
$getforuminfo=$DB_site->query_first("SELECT title FROM forum WHERE forumid='$forumid'");
$forum_ad_keywords=$getforuminfo[title];
// Replace generic words
$forum_ad_keywords = str_replace(" and ", " ", $forum_ad_keywords);
$forum_ad_keywords = str_replace(" the ", " ", $forum_ad_keywords);
$forum_ad_keywords = str_replace(" with ", " ", $forum_ad_keywords);
$forum_ad_keywordss = str_replace(" or ", " ", $forum_ad_keywords);
$forum_ad_keywords = str_replace("/", " ", $forum_ad_keywords);
// Replace spaces with commas (for phpAdsNew OR keywords)
$forum_ad_keywords = str_replace(" ", ",", $forum_ad_keywords);
}
// END HACK
Let me give you an example. Let's say you have 2 forums:
Outdoor Hiking
Wild and Crazy Sex
Strange combination, I know - but bear with me. This hack will create a special variable called "$forum_ad_keywords", which will look like this (using the 2 examples above):
Outdoor,Hiking
Wild,Crazy,Sex
To use these in a template (i.e. header) to grab a target ad, you might try something like:
// figure out the chosen style settings
// BSB - HACK - Need to populate foruminfo for targeted ads
if(isset($forumid)) {
$getforuminfo=$DB_site->query_first("SELECT title FROM forum WHERE forumid='$forumid'");
$forum_ad_keywords=strtolower($getforuminfo[title]);
// Replace generic words
$forum_ad_keywords = str_replace(" and ", " ", $forum_ad_keywords);
$forum_ad_keywords = str_replace(" the ", " ", $forum_ad_keywords);
$forum_ad_keywords = str_replace(" with ", " ", $forum_ad_keywords);
$forum_ad_keywords = str_replace(" or ", " ", $forum_ad_keywords);
$forum_ad_keywords = str_replace("/", " ", $forum_ad_keywords);
$forum_ad_keywords = str_replace(" & ", " ", $forum_ad_keywords);
$forum_ad_keywords = str_replace(" for ", " ", $forum_ad_keywords);
// Parent forum inside thread pages
if(isset($threadid)) {
$getforuminfo=$DB_site->query_first("SELECT forum.title FROM forum,thread WHERE threadid='$threadid' AND forum.forumid=thread.forumid");
It is the same hack, only add on is for putting keywords of parent forum inside thread pages.
In global.php, find:
Quote:
// figure out the chosen style settings
Below that, add:
Quote:
// BSB - HACK - Need to populate foruminfo for targeted ads
if(isset($forumid)) {
$getforuminfo=$DB_site->query_first("SELECT title FROM forum WHERE forumid='$forumid'");
$forum_ad_keywords=strtolower($getforuminfo[title]);
// Replace generic words
$forum_ad_keywords = str_replace(" and ", " ", $forum_ad_keywords);
$forum_ad_keywords = str_replace(" the ", " ", $forum_ad_keywords);
$forum_ad_keywords = str_replace(" with ", " ", $forum_ad_keywords);
$forum_ad_keywords = str_replace(" or ", " ", $forum_ad_keywords);
$forum_ad_keywords = str_replace("/", " ", $forum_ad_keywords);
$forum_ad_keywords = str_replace(" & ", " ", $forum_ad_keywords);
$forum_ad_keywords = str_replace(" for ", " ", $forum_ad_keywords);
// Parent forum inside thread pages
if(isset($threadid)) {
$getforuminfo=$DB_site->query_first("SELECT forum.title FROM forum,thread WHERE threadid='$threadid' AND forum.forumid=thread.forumid");
PhpAdsNew is powerful application, you can us any banner and any size of banner. Look in phpAdsNew user-guide for banner invocation code statements and adapt it for your needs.
How can I type in the keywords, so that when I type: for,sale,by,vendors since there is "by" in the forum title #2, the banner would only show up in the the vendor forum and not the member one.