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

Implementing Ad Support Into Your Site With PHPAdsNew


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.

Author Info:
By: Mitchell Harper
Rating: 4 stars4 stars4 stars4 stars4 stars / 7
May 04, 2002
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

print this article
SEARCH DEVARTICLES

Implementing Ad Support Into Your Site With PHPAdsNew - Using PhpAdsNew
(Page 3 of 5 )

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 a <script> 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.
blog comments powered by Disqus
PHP ARTICLES

- Removing Singletons in PHP
- Singletons in PHP
- Implement Facebook Javascript SDK with PHP
- Making Usage Statistics in PHP
- Installing PHP under Windows: Further Config...
- File Version Management in PHP
- Statistical View of Data in a Clustered Bar ...
- Creating a Multi-File Upload Script in PHP
- Executing Microsoft SQL Server Stored Proced...
- Code 10x More Efficiently Using Data Access ...
- A Few Tips for Speeding Up PHP Code
- The Modular Web Page
- Quick E-Commerce with PHP and PayPal
- Regression Testing With JMeter
- Building an Iterator with PHP

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials