Register Members List Search Today's Posts Mark Forums Read

Reply
 
Article Options
Using PHPadsnew 2 with Vbulletin 3.
Michael Morris
Join Date: Nov 2003
Posts: 774

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

Knoxville TN
by Michael Morris Michael Morris is offline 31 Jan 2005

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...


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Place it in your PHPINCLUDE_START template, but omit the final echo statement and the <?php ?> tags. It will look like this...


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

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.


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

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.


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

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

Last edited by Michael Morris; 23 Mar 2005 at 13:17.. Reason: Error correction
Views: 32624
Reply With Quote
Comments
  #2  
Old 26 Feb 2005, 05:43
Michael Morris's Avatar
Michael Morris Michael Morris is offline
 
Join Date: Nov 2003
Real name: Michael Morris
New Hint.

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:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Directly above it add


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

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.

Last edited by Michael Morris; 26 Feb 2005 at 05:46.
Reply With Quote
  #3  
Old 26 Feb 2005, 06:22
FrankieFive FrankieFive is offline
 
Join Date: Feb 2005
What should i put as the file name?
Reply With Quote
  #4  
Old 26 Feb 2005, 06:37
Michael Morris's Avatar
Michael Morris Michael Morris is offline
 
Join Date: Nov 2003
Real name: Michael Morris
phpads-vbulletin.inc.php would work
Reply With Quote
  #5  
Old 27 Feb 2005, 19:23
FrankieFive FrankieFive is offline
 
Join Date: Feb 2005
I tried running the maintenance.php on my VBulletin 3.0.7 and wanted to make sure it was working so I tried to run it and got this error.

PhpAdsNew Maintenance


Warning: main(/www/adserver/maintenance/maintenance.php): failed to open stream: No such file or directory in /admincp/cronadmin.php on line 56

Fatal error: main(): Failed opening required '/www/adserver/maintenance/maintenance.php' (include_path='.:/usr/local/nf/lib/php') in /mnt/web_h/d48/s32/b0239134/www/forums/admincp/cronadmin.php on line 56
Reply With Quote
  #6  
Old 28 Feb 2005, 09:06
Michael Morris's Avatar
Michael Morris Michael Morris is offline
 
Join Date: Nov 2003
Real name: Michael Morris
Right there - the error message told me what I need to help you.. The absolute path to the file you want to include should be..

/mnt/web_h/d48/s32/b0239134/www/adserver/maintenance/maintenance.php
Reply With Quote
  #7  
Old 28 Feb 2005, 17:05
FrankieFive FrankieFive is offline
 
Join Date: Feb 2005
Hi mike I tired what you said to put: (/mnt/web_h/d48/s32/b0239134/www/adserver/maintenan
I still get an error! How much will it cost to fix the problem for me?

PhpAdsNew Maintenance


Warning: main(/mnt/web_h/d48/s32/b0239134/www/adserver/maintenan): failed to open stream: No such file or directory in /admincp/cronadmin.php on line 56

Fatal error: main(): Failed opening required '/mnt/web_h/d48/s32/b0239134/www/adserver/maintenan' (include_path='.:/usr/local/nf/lib/php') in /mnt/web_h/d48/s32/b0239134/www/forums/admincp/cronadmin.php on line 56
Reply With Quote
  #8  
Old 28 Feb 2005, 19:38
ALcorn ALcorn is offline
 
Join Date: Oct 2004
FrankieFive, you need to adjust the number of caracters of the field filename of the table cron of your database because the default value of 50 caracters is not enought.

Try to run this query in the PHPMyAdmin:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Reply With Quote
  #9  
Old 28 Feb 2005, 21:12
FrankieFive FrankieFive is offline
 
Join Date: Feb 2005
Originally Posted by ALcorn
FrankieFive, you need to adjust the number of caracters of the field filename of the table cron of your database because the default value of 50 caracters is not enought.

Try to run this query in the PHPMyAdmin:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.
Is there a step by step instruction on how to do this?
Reply With Quote
  #10  
Old 01 Mar 2005, 10:22
Michael Morris's Avatar
Michael Morris Michael Morris is offline
 
Join Date: Nov 2003
Real name: Michael Morris
Originally Posted by FrankieFive
Is there a step by step instruction on how to do this?
From the Admincp go to Import & Maintenance >> Execute SQL Query. Type int query exactly as given above.

If you get a "You don't have permission to run queries" error you'll need to edit your config.php file to give yourself permission to run queries.
Reply With Quote
  #11  
Old 01 Mar 2005, 19:32
FrankieFive FrankieFive is offline
 
Join Date: Feb 2005
I tried submitting it and got an error enclosed is a picture of my phpadmin. Is there anything missing or needs to be corrected?

Reply With Quote
  #12  
Old 01 Mar 2005, 21:19
Super Ted Super Ted is offline
 
Join Date: Apr 2002
I want to display several zones in a page. Is this possible in VB3?

Edit: Silly Question! Should have read all the thread!

I am getting a Permission denied error when I try and run the cron job for maintenance.php I have tried changing the file permissions to 777 (not the best idea!) but now I get

/pub/home/****/htdocs/adserver/maintenance/maintenance.php: cannot open ?php: no such file
/pub/home/****/htdocs/adserver/maintenance/maintenance.php: /bin/: permission denied
/pub/home/****/htdocs/adserver/maintenance/maintenance.php: /backup: symbolic link loop
/pub/home/****/htdocs/adserver/maintenance/maintenance.php: /backup: symbolic link loop
/pub/home/****/htdocs/adserver/maintenance/maintenance.php: /backup: symbolic link loop
/pub/home/****/htdocs/adserver/maintenance/maintenance.php: 7: Syntax error: "(" unexpected

What permissions should be set to allow this cron job to be run?

Last edited by Super Ted; 01 Mar 2005 at 22:19. Reason: Automerged Doublepost
Reply With Quote
  #13  
Old 02 Mar 2005, 21:33
Super Ted Super Ted is offline
 
Join Date: Apr 2002
I have tried running the vbcron and get the same error as Frankie.
Reply With Quote
  #14  
Old 02 Mar 2005, 22:48
FrankieFive FrankieFive is offline
 
Join Date: Feb 2005
Originally Posted by Super Ted
I have tried running the vbcron and get the same error as Frankie.

Mike I installed the invocation code into the php_start and the little piece of coding in the header and my banners aren't showing up. Also the maintenance error is still happening.
Reply With Quote
  #15  
Old 03 Mar 2005, 06:12
Michael Morris's Avatar
Michael Morris Michael Morris is offline
 
Join Date: Nov 2003
Real name: Michael Morris
The most likely reason is a size mismatch. Make sure the banners attached to the zone are exactly the right size.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Article Options

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


New To Site? Need Help?

All times are GMT. The time now is 22:51.

Layout Options | Width: Wide Color: