Home arrow PHP arrow Page 3 - Implementing Ad Support Into Your Site With PHPAdsNew

Using PhpAdsNew&toc - PHP

PhpAdsNew is one of the most popular open source ad projects on the Internet. We use it right here on devArticles to manage ads for our advertisers, and I would honestly have to say that it's the best ad management system I've ever used. In this article Mitchell's going to give you a guided tour of PhpAdsNew, including how to install it, how to create your first banner, and also how to create your first banner rotation.

TABLE OF CONTENTS:
  1. Implementing Ad Support Into Your Site With PHPAdsNew
  2. What is PhpAdsNew?
  3. Using PhpAdsNew
  4. Stats and banner rotations
  5. Conclusion
By: Mitchell Harper
Rating: starstarstarstarstar / 10
April 15, 2004

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement
PhpAdsNew has zones, clients, and banners. First off, we want to add a client, so click on the administration tab and then the add new client link. Complete the details of the client when the page loads. Before you click on the save changes button, you should think carefully about whether or not you would like to allow this client to login to your PhpAdsNew system and modify his campaign.

If you'd like to give your clients the flexibility of changing their banner whenever they like, then you should enter a username and password for them and select the appropriate checkboxes for them, which are shown below:

PhpAdsNew client options

When you're done, click on the save changes button. PhpAdsNew will now let you create a new campaign for this client. The great thing about PhpAdsNew is that you can either set how many impressions this clients ad will have, you can set both activation and expiry dates for the ad, or you can just let the ad run for as long as you like.

The weight field is the frequency that the ad will be shown. The default is 1, but you can set it to a higher value if you'd like the ad to appear more frequently than any others if it's in a rotation.

Set the options for this clients campaign then click save changes. PhpAdsNew will create the new campaign and redirect you back to the zones page. To create a banner for this client, click on the create link under their campaign:

Adding a new banner for a client

Once the add new banner page loads, there are four possible types of banners that we can create:
  • Banner stored in SQL: This option allows you to upload an image directly into the PhpAdsNew MySQL database. It's stored as a blob, and you don't have to worry about storing image files on your server.
  • Banner stored on the Webserver: If you'd like to store your banner images on your webserver, then choose this option.
  • Banner references to through URL: This option allows you to reference a banner that's available online (i.e. http://...). If you're running banners as part of an ad network, then this is the option that you're after.
  • HTML banner: HTML banners are ideal for rich media ads such as flash movies, or even plain text ads, which generally have a great click-thru rate (CTR).
For this article, we'll create a banner stored in SQL, so select that option and choose/create a banner from your hard drive. I have created a simple 468x60 banner. Once you click on the submit ad button, PhpAdsNew will show you how your banner will look. Here's what mine looked like:

Previewing my banner with PhpAdsNew

Now that our banner's created, it's time to tell PhpAdsNew to generate the banner code for it, which we can include in our web pages to display the banner. Click on the administration tab and then the generate banner code link, just under the tab. Once again, there are several options to choose from. The way the banner is invocated can be one of five possible options:
  • Remote Invocation: An image tag will be generated that points to the location of PhpAdsNew's adview.php script, passing in the ID of the client whose banner we want to display.
  • Remote Invocation with JavaScript: Generates aSCRIPT tag which references adjs.php, which uses JavaScript's document.write function to display the banner.
  • Remote Invocation for iFrames: Generates an iframe tag that references adframe.php. Adframe.php returns the image so it's displayed inside of the iFrame.
  • Combined Remote Invocation: Uses a combination of an iframe tag and script tag to generate a banner called from JavaScript based inside of an iFrame.
  • Local Mode: PHP code that includes phpadsnew.inc.php and calls that scripts view function. This is the default mode, however if you're using MySQL in other areas of your site to display data, then I would recommend staying away from this option.
Once you've chosen your banner display options, you'll need to select the banner to be displayed from the ClientID drop down list. If you'd like the URL that the banner links to open in a new window, enter something like _blank in the target field. In this example I'm using remote invocation, so here's the code that PhpAdsNew generated when I clicked on the generate button:

<a href="' http://localhost/phpAdsNew/adclick.php'" target='_blank'><img src="'http://localhost/phpAdsNew/adview.php?clientID=2&target=_blank'"; border='0'></a>

Obviously at this point, it's simply a matter of copying and pasting the generate code into your web page and then saving it.

At this point we haven't really explored the power of PhpAdsNew, so let's now take a look at its powerful reporting and banner rotation features.

 
 
>>> More PHP Articles          >>> More By Mitchell Harper
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

PHP ARTICLES

- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: