Go Back   vb.org Archive > vBulletin Article Depository > Read An Article > vBulletin 3 Articles
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Using PHPadsnew 2 with Vbulletin 3.
Michael Morris's Avatar
Michael Morris
Join Date: Nov 2003
Posts: 774

Employee of Digital Media Graphix of Knoxville TN, currently developing a new framework / CMS

Knoxville TN
Show Printable Version Email this Page Subscription
Michael Morris Michael Morris is offline 01-30-2005, 10:00 PM

The following are some tips on using these two programs together, based on my own experience. It's expected that you know how to use phpadsnew 2 to set up ads and generate invocation code.

PHP Invocation
The first tip is how to use php invocation code. Using javascript is possible, but not all browsers support javascript and, in my experience, using php is faster.

The php invocation code phpadsnew generates will look something like this...

PHP Code:
<?php
    
if (@include(getenv('DOCUMENT_ROOT').'/phpads/phpadsnew.inc.php')) {
        if (!isset(
$phpAds_context)) $phpAds_context = array();
        
$phpAds_raw view_raw ('zone:2'0'''''0'$phpAds_context);
        echo 
$phpAds_raw['html'];
    }
?>
Place it in your PHPINCLUDE_START template, but omit the final echo statement and the <?php ?> tags. It will look like this...

PHP Code:
    if (@include(getenv('DOCUMENT_ROOT').'/phpads/phpadsnew.inc.php')) {
        if (!isset(
$phpAds_context)) $phpAds_context = array();
        
$phpAds_raw view_raw ('zone:2'0'''''0'$phpAds_context);
    } 
Now, to place the add, put the variable $phpAds_raw[html] in any template that you want that ad to appear (usually your header). Remember to omit the '' marks when placing the variable in a normal template - therefore $phpAds_raw['html'] becomes $phpAds_raw[html]

If you have multiple zones, you can string these together. On EN World we have a zone that only appears on our vbadvanced news page. On those pages we call the view_raw function an additional time for the extra zone (view_raw is the function that actually calls up the ad - the rest of the code initializes phpadsnew). Here's our code, as an example of a 2 zone system.

PHP Code:
if (@include(getenv('DOCUMENT_ROOT').'/phpads/phpadsnew.inc.php')) 
{
    if (!isset(
$phpAds_context)) 
    {
        
$phpAds_context = array();
        
$phpAds_raw view_raw ('zone:2'0'''''0'$phpAds_context);
        if (
defined('VBA_PORTAL'))
        {
            
$phpAds_context2 = array();
            
$phpAds_raw2 view_raw ('zone:3'0'''''0'$phpAds_context2);
        }
    }

Running Maintenance.php from the scheduled task manager
Ads new's maintenance.php file needs to run on a regular basis for it to perform correctly. You can invoke it from your scheduled task manager if you wish. If you do, I'd advise applying the following mod to the code of the maintenance.php file.

Open it and go to the ending ?> mark. Right about it add this.

PHP Code:
log_cron_action('PHP Ads New Maintenance Complete'$nextitem); 
And you're done. The file can now log it's cron action with vbulletin's cron manager. Note that if you make this change you will be unable to call the maintenance.php file without vbulletin since it will trigger a fatal error (call to undefined function). Also, there's a glitch in phpadsnew - when vbulletin invokes maintenance.php it somehow forgets that it was ever invoked. The log files both in vbulletin and in phpadsnew itself speak differently, but phpadsnew continues to echo a message saying the maintenance.php script hasn't been ran which can be ignored.

Any other tips/comments/questions welcomed.

PHP Ads New 2 is at http://www.phpadsnew
Reply With Quote
  #52  
Old 07-07-2005, 04:50 PM
Fallback Fallback is offline
 
Join Date: May 2005
Posts: 61
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This mod works great for me with no problems... thanks!
Reply With Quote
  #53  
Old 07-07-2005, 06:53 PM
m0nde's Avatar
m0nde m0nde is offline
 
Join Date: Mar 2005
Location: Toronto, ON Canada
Posts: 204
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I haven't used the script in this thread at all to use phpAdsNew. I've set it up as if phpadsnew were residing on a separate computer all together and simply called it using the invocation code generated in phpAdsNew for each publication location. This works fine and i'm using it on several sites.

http://www.bostonlove.org uses it for several spots on the site include the top the middle and the bottom.

http://www.yyzlifestyle.com uses it for the stuff at the bottom.

I've tied it into the vbaffiliates hack so that it counts each link in the affiliates module each time someone clicks on the appropriate affiliate's banner - all of this with just using phpadsnew without customisation for vbulletin.

I'm even using it to track who clicks on my paypal donation buttons.

- Sid
Reply With Quote
  #54  
Old 07-09-2005, 05:35 PM
jsharper jsharper is offline
 
Join Date: Jun 2005
Location: Gilbert, AZ, US
Posts: 21
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by jsharper
I'm also having a logout problem. Whenever my phpinclude_start is calling phpadsnew.inc.php, my vBulletin logout function is broken. clicking Log Out just returns a blank page and doesn't actually perform the logout.

Ideas? I'm using vBulletin 3.0.7 and phpAdsNew 2.0.5. I did try both with and without "Use database compatibility mode".
In case anyone else is running into this, a solution can be found here:
http://forum.phpadsnew.com/index.php?showtopic=8281

Jason
Reply With Quote
  #55  
Old 07-10-2005, 01:23 AM
Rob Locke Rob Locke is offline
 
Join Date: Mar 2004
Posts: 16
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Michael Morris
Here's a way to prevent certain usergroups from being logged as having seen an ad (they'll still see them but the ad view won't be logged). In the file phpadsnew.inc.php find the following code:

PHP Code:
if ($phpAds_config['log_adviews'] && !$phpAds_config['log_beacon']) 
Directly above it add

PHP Code:
if (is_member_of($bbuserinfo6))
{
$phpAds_config['log_adviews'] = false;

If you need to use your phpadsnew installation for non vbulletin pages you'll need to create seperate versions of phpadnew.inc.php for vbulletin and your other pages to call.
May I just double check that if I want to include several usergroups, the id numbers would just be separated by commas?

For Example:
PHP Code:
if (is_member_of($bbuserinfo6,7,8)) 
Reply With Quote
  #56  
Old 07-10-2005, 08:28 PM
wolf314 wolf314 is offline
 
Join Date: Jun 2005
Posts: 2
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by jsharper
In case anyone else is running into this, a solution can be found here:
http://forum.phpadsnew.com/index.php?showtopic=8281

Jason

Thanks!!! This is what I've been looking for.
Reply With Quote
  #57  
Old 07-12-2005, 06:19 PM
boske boske is offline
 
Join Date: Jul 2005
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by camoman
I think I am looking for a similiar thing.. Basically I want to be able to have a unique zone for each forum... so banners at the top of each forum would be relevent to the forum title. ie. in the boat forum I only want boat related ads showing up, in the snowmobile forum I only want snowmobile ads showing up etc..

Can this be done??
yeah Ive seen this done on other vb boards..im sure there is a way....

I don't know how, but I'd like to do the same thing.. :squareeyed:

After trying this numerous times, I still can't get it to work...
Reply With Quote
  #58  
Old 07-13-2005, 04:01 PM
Gio Gio is offline
 
Join Date: Aug 2004
Location: Washington DC
Posts: 26
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Will this work on 3.5.0 vb?
Reply With Quote
  #59  
Old 07-13-2005, 04:46 PM
cerebro's Avatar
cerebro cerebro is offline
 
Join Date: Dec 2001
Posts: 77
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i upgrate to phpAdsNew 2.0.5 and the logout function inst work.
When reload the site...the user still there. Didt work
Reply With Quote
  #60  
Old 07-14-2005, 06:01 PM
ludachris ludachris is offline
 
Join Date: Feb 2002
Posts: 287
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hey Michael, not sure if you're still paying attention to this thread or not, but....

I tried setting up the Maintenance.php to be run via the Scheduled Tasks Manager. I'm receiving errors when running it:


Warning: Cannot modify header information - headers already sent by (output started at /var/www/mysitename.com/html/forums/includes/adminfunctions.php:222) in /var/www/mysitename.com/html/phpads/libraries/lib-cache.inc.php on line 16

Warning: Cannot modify header information - headers already sent by (output started at /var/www/mysitename.com/html/forums/includes/adminfunctions.php:222) in /var/www/mysitename.com/html/phpads/libraries/lib-cache.inc.php on line 17

Warning: Cannot modify header information - headers already sent by (output started at /var/www/mysitename.com/html/forums/includes/adminfunctions.php:222) in /var/www/mysitename.com/html/phpads/libraries/lib-cache.inc.php on line 18

Done


What could this be attributed to, and does this mean the maintenance script is NOT running?
Reply With Quote
  #61  
Old 07-15-2005, 04:03 PM
jsharper jsharper is offline
 
Join Date: Jun 2005
Location: Gilbert, AZ, US
Posts: 21
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by cerebro
i upgrate to phpAdsNew 2.0.5 and the logout function inst work.
When reload the site...the user still there. Didt work
Look up a few posts to post #53.
Reply With Quote
Reply


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 08:19 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.05299 seconds
  • Memory Usage 2,328KB
  • 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
  • (7)bbcode_php
  • (5)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_article
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)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
  • (11)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
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete