Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 2.x > vBulletin 2.x Full Releases

Reply
 
Thread Tools
Details »»

Version: , by (Guest)
Developer Last Online: Jan 1970 Show Printable Version Email this Page

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:

Code:
<a href="/ads/admin/adclick.php?n=$VBRandomX"><img src="/ads/admin/adview.php?n=$VBRandomX&what=$forum_ad_keywords" border="0"></a>
Note: the VBRandomX numbers are another hack. Just put this line in global.php to get some random #'s for the ad call:

Code:
$VBRandomX = time();
Easy enough. Not a real great randomizer, but it works for my needs. You want it to do more, have at it.

At any rate, the ad code above would expand to something like:

Code:
<a href="/ads/admin/adclick.php?n=993088616"><img src="/ads/admin/adview.php?n=993088616&what=Outdoor,Hiking" border="0"></a>
Now all you need to do is use those keywords when creating accounts within phpAdsNew.

Voila - instant targeted ads.

A robust, scalable targeted ad/sponsorship system should really be a part of the next release - IMHO.

Cheers.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #22  
Old 04-22-2003, 10:31 PM
Dejan Dejan is offline
 
Join Date: Nov 2001
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It works fine in vB 2.30. I am using this code:

Quote:

// 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);

// Replace spaces with commas (for phpAdsNew OR keywords)
$forum_ad_keywords = str_replace(" ", ",", $forum_ad_keywords);
} else {
$forum_ad_keywords = 'home';
}



// 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");

$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);
$forum_ad_keywords = str_replace(" i ", " ", $forum_ad_keywords);

// Replace spaces with commas (for phpAdsNew OR keywords)
$forum_ad_keywords = str_replace(" ", ",", $forum_ad_keywords);
}

// END HACK
Reply With Quote
  #23  
Old 04-23-2003, 02:47 AM
cnczone cnczone is offline
 
Join Date: Mar 2003
Posts: 128
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Where do I install it?
Reply With Quote
  #24  
Old 04-23-2003, 09:12 AM
Dejan Dejan is offline
 
Join Date: Nov 2001
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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);

// Replace spaces with commas (for phpAdsNew OR keywords)
$forum_ad_keywords = str_replace(" ", ",", $forum_ad_keywords);
} else {
$forum_ad_keywords = 'home';
}



// 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");

$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);
$forum_ad_keywords = str_replace(" i ", " ", $forum_ad_keywords);

// Replace spaces with commas (for phpAdsNew OR keywords)
$forum_ad_keywords = str_replace(" ", ",", $forum_ad_keywords);
}

// END HACK
I am using old version of phpAdsNew and Remote Invocation with JavaScript. For that, in header template put:

Quote:
<script language="JavaScript" src="http://www.your.path.to.phpadsnew/adjs.php?what=$forum_ad_keywords,+468x60&target=_blank">
</script>
Change 468x60 for the banner size you are using.
Reply With Quote
  #25  
Old 04-23-2003, 09:43 PM
cnczone cnczone is offline
 
Join Date: Mar 2003
Posts: 128
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for your help, now once I put the code in how do I call a banner to a fourm, do I use the forum name?
Reply With Quote
  #26  
Old 04-24-2003, 05:07 PM
Dejan Dejan is offline
 
Join Date: Nov 2001
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yes, just use forum name as keyword.
Reply With Quote
  #27  
Old 04-24-2003, 06:58 PM
cnczone cnczone is offline
 
Join Date: Mar 2003
Posts: 128
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

but the banner has to be the right size right? I can just use any banners of different sizes correct?
Reply With Quote
  #28  
Old 04-26-2003, 06:37 AM
Dejan Dejan is offline
 
Join Date: Nov 2001
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #29  
Old 05-23-2003, 02:24 AM
Imprezer Imprezer is offline
 
Join Date: Dec 2002
Posts: 55
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok, so I copy pasted the code from Dejan's post below the "// figure out the chosen style settings".

Then I added key words for banners replacing space in forum name with a ,.

It doesnt work.

I got banners all over the site. It doesnt seem to be looking at the keywords.

What am I doing wrong?
Reply With Quote
  #30  
Old 05-23-2003, 02:42 AM
Imprezer Imprezer is offline
 
Join Date: Dec 2002
Posts: 55
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nevermind.

I figured it out.

Works like a charm.
Reply With Quote
  #31  
Old 05-23-2003, 03:49 AM
Imprezer Imprezer is offline
 
Join Date: Dec 2002
Posts: 55
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hmm, it works, but I need help.

I have 2 forums.

FOR SALE BY VENDORS
FOR SALE BY MEMBERS

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.

Thanks!
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:00 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04993 seconds
  • Memory Usage 2,304KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (5)bbcode_code
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • postbit_imicons
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete