vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Targeted ads for phpAdsNew (https://vborg.vbsupport.ru/showthread.php?t=20853)

06-20-2001 10:00 PM

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.

Pingu 06-21-2001 08:39 PM

I already have ads targeting forums (by their names).

But the problem is just there: those names can get pretty long, and all keywords together for one single banner can make a pretty long line.

So my next step is to add an extra field, with something like forum_short_name
I've tried the forumnumber, but it doesn't work (because the number is a number and not text or something?! I don't know PHP/MySQL well enough)

But a hack like this one is very good :)

eva2000 06-21-2001 08:46 PM

wow this looks fantastic, i'm using phpadsnew as well on my vB http://animeboards.com

but it does lack targetted ads... gonna try this out

JonnyQuest 06-22-2001 06:08 PM

Is there anyway you can make this so it pulls the actual title tag of the page? I'm using it to make a keyword search in my store.
Thanks!

Byron 06-29-2001 12:13 AM

this is a useful hack. thanks

Byron 06-29-2001 12:26 AM

this is a useful hack. thanks

Lionel 01-25-2002 12:12 PM

thanks

mvigod 02-14-2002 03:59 PM

what is the "n=" mean and why bother with the VbRandomX thing you have in this? Is the random thing just for cache busting or does it serve any other purpose?

mvigod 02-16-2002 11:54 PM

I changed just a little...

// 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';
// }

// END HACK

X-Fan 02-17-2002 06:45 AM

Just wondering how difficult would it be to incorporate phpAdsNew on a board that runs the vbPortal front end (as it has its own banner rotation system)?


All times are GMT. The time now is 10:03 AM.

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.01021 seconds
  • Memory Usage 1,739KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (5)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete