Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
  #1  
Old 10-25-2005, 03:29 PM
sully02 sully02 is offline
 
Join Date: Jul 2004
Posts: 161
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Putting Ads on forums

I know the first thing you're thinking... Well, why don't you use (insert ad hack/mod here)?

I would, if I didn't have certain conditions that I want for my ads. I think I'm doing this right, but considering my low experience with PHP/MySQL, I figured I'd double check before going ahead with this.

The ads I am inserting are flash buttons specific to each forum on my board. I run a sports forum, so each ad is for each team that has a forum. I can't have it be random, and I already have tools to analyze ad stats for this affiliate. Here's what I'm thinking for a plan of attack:

1] Generate the HTML for each flash button
2] Add a field to the table of forums in the database for the ads (We'll call it forumad for now).
3] Store the HTML for the flash button in forumad.
4] Add forumad to the list of fields retrieved in forumdisplay.php
5] In the FORUMDISPLAY template, add a line $foruminfo[forumad] to retrieve the ad.

If I'm doing this right, this should call the advertisement assigned to the forum in question. Am I doing anything wrong here?
Reply With Quote
  #2  
Old 10-25-2005, 03:34 PM
tamarian tamarian is offline
 
Join Date: Oct 2001
Location: Canada
Posts: 1,205
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by sully02
1] Generate the HTML for each flash button
2] Add a field to the table of forums in the database for the ads (We'll call it forumad for now).
3] Store the HTML for the flash button in forumad.
4] Add forumad to the list of fields retrieved in forumdisplay.php
5] In the FORUMDISPLAY template, add a line $foruminfo[forumad] to retrieve the ad.

If I'm doing this right, this should call the advertisement assigned to the forum in question. Am I doing anything wrong here?
Not wrong, but you can accomplish this without altering your forum table. You can either create a separate table for the ads which you can "join", or better yet, just pass the forum id to your ad server software, this can be done in the template, without any code changes. If you are running phpAdsNew, you can restrict the ads served in each forum to ads made for that specific forum id.
Reply With Quote
  #3  
Old 10-25-2005, 03:37 PM
sully02 sully02 is offline
 
Join Date: Jul 2004
Posts: 161
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by tamarian
Not wrong, but you can accomplish this without altering your forum table. You can either create a separate table for the ads which you can "join", or better yet, just pass the forum id to your ad server software, this can be done in the template, without any code changes. If you are running phpAdsNew, you can restrict the ads served in each forum to ads made for that specific forum id.
I'm not using phpAdsNew, it's an affiliate program, like AdSense, where the stats are kept on their site. I get the code for the Flash Buttons, and I need to get them on my site. The creation of a separate table seems like a good idea. If I read it right, all I'd need are two columns... One for the forumid, and another for the HTML code for the ad, correct?
Reply With Quote
  #4  
Old 10-25-2005, 03:51 PM
tamarian tamarian is offline
 
Join Date: Oct 2001
Location: Canada
Posts: 1,205
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by sully02
I'm not using phpAdsNew, it's an affiliate program, like AdSense, where the stats are kept on their site. I get the code for the Flash Buttons, and I need to get them on my site. The creation of a separate table seems like a good idea. If I read it right, all I'd need are two columns... One for the forumid, and another for the HTML code for the ad, correct?
In that case, yes, that is correct. A separate table, and no need for a "join". Just create a new script to return the HTML code for each forum id. This script can be called from the hooks in forumdisplay and showthread, something like, $ThisForumHTMLCode = GetMeMyHTMLCode($forumid); and put $ThisForumHTMLCode in the forum display and showthread templates.
Reply With Quote
  #5  
Old 10-25-2005, 03:52 PM
sully02 sully02 is offline
 
Join Date: Jul 2004
Posts: 161
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by tamarian
In that case, yes, that is correct. A separate table, and no need for a "join". Just create a new script to return the HTML code for each forum id. This script can be called from the hooks in forumdisplay and showthread, something like, $ThisForumHTMLCode = GetMeMyHTMLCode($forumid); and put $ThisForumHTMLCode in the forum display and showthread templates.
I'm not using 3.5 yet, but I will have to keep that in mind when I do upgrade.

Right now, I'm on version 3.0.3

Quote:
Originally Posted by sully02
I'm not using 3.5 yet, but I will have to keep that in mind when I do upgrade.

Right now, I'm on version 3.0.3
I think I've got it here...

I've created a table with two fields, one for the forumid, and one for the ad code.

I'll need to add a query to forumdisplay.php (Not sure exactly where in the file) for the following:

PHP Code:
$advertisement $DB_site->query("
    SELECT forumad, forumid
    FROM advertisements AS ads
    WHERE ads.forumid == 
$foruminfo[forumid]
    "
); 
From there, I should be able to just put $advertisement into the FORUMDISPLAY template, and it'll work, I hope.
Reply With Quote
Reply

Thread Tools
Display Modes

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 06:07 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04273 seconds
  • Memory Usage 2,201KB
  • Queries Executed 13 (?)
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
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_php
  • (5)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)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_postinfo_query
  • fetch_postinfo
  • 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
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete