Banner Management With phpAdsNew (Part two)

In this second part of a three-part tutorial covering phpAdsNew, you will learn more about the features of the “Publishers” and “Advertisers” module, as well as a convenient way to integrate phpAdsNew with multiple websites, and more.

Catching Up

A few weeks ago, in the first part of this three-part tutorial, I outlined a quick-start guide on how to integrate phpAdsNew with your website. Three parts? Yes, that’s correct. What started as a two-part article had to be extended to three parts in order to do justice to this versatile tool!

Here is a quick re-cap of the first part: I started by showing you how to install the software by using the browser-based installation wizard, which ships along with the source code archive. This was followed by an explanation of the different phpAdsNew entities, such as “publishers,” “advertisers,” “campaigns,” “banners” and more. Finally, the article demonstrated the ease with which you can integrate the application with your website.

But there is a lot more to this nifty open source tool!

In this second part, I’ll start by explaining the different features of the “publisher” and “advertiser” modules that I had to skip in the first part for lack of space. Next, I’ll provide detailed instructions of how to manage the ad banners across multiple websites from a single instance of phpAdsNew. This will be followed by an introduction to “Remote Invocation for JavaScript,” which is an interesting technique that allows third-party websites to display banners from your phpAdsNew installation.

A little note before moving to the next section: the version of phpAdsNew that I used in the first part has been patched to include important security fixes. So, I recommend that you download the latest version from before proceeding any further.

{mospagebreak title=Publishers Revisited}

Let me explain some of the additional features of the “Publishers and zones” and “Advertisers and campaigns” modules that I had to skip earlier for lack of time and space.

Log on to the phpAdsNew administration module with your “administrator” credentials. Navigate to the “Inventory” section and click on the “Add new publisher” option.

This time, I would like to highlight the different security privileges that you can assign to a   “publisher.” For example, it is possible that you may hire someone to manage the show while you are busy vacationing in the Bahamas with the fortunes you’ve earned from the website. The options that you see in the screen shot, above, will allow you to define the privileges that this new publisher enjoys when accessing the phpAdsNew administration module.

Next, you must define a “zone” for the publisher. Here, let’s select the “IAB Leader Board” banner type, in order to keep things different from the first part. If you’re not already aware, this banner type displays a horizontal banner across the page, as is evident from the associated dimensions. 

Here is a quick overview of the other types of “zones” that you can create in phpAdsNew:

  • Banner, Button, Rectangle: this widely-used banner type allows you to display JPEG or GIF images or Flash SWF movies.

  • Interstitial or Floating DHTML: these allow you to display dynamic ads that move around the screen when a visitor accesses your website.

  • Pop-Up: as the name suggests, this option will load the banner in a new pop-up window whenever visitors access your website(s). They may not like it, but then – as they say – there is no such thing as a free lunch!

  • Text-ad: this format allows advertisers to display text information about their product (or services); it also allows for better targeting of audiences when integrated with search engines, as seen by the tremendous popularity of the Google AdSense program.

One important point to keep in mind before defining your banner types: each is associated with a different “invocation code.” So, if you decide to change your banner type later, you need to update your code accordingly. This is a painful exercise if the website consists of tons of static HTML pages. Don’t say I didn’t warn you!

Coming back to phpAdsNew: for each zone that you’ve created, you can tweak its “Advanced” settings to configure another “zone” (or “banner”) that the tool should display when there are no more “AdViews” associated with the current zone. The general norm is to define a default zone – as I showed you in the first part – with unlimited “AdViews” so that phpAdsNew can continue to serve banners seamlessly!

On this screen, you can specify whether you want to append another banner to the current one; just review the options in the drop down to view a list of banner types that you can play around with.

The “Linked banners” tab allows you to select the “campaigns,” if they have already been added, that you wish to use with the current zone. I bet you already knew that — but you might not have been aware of the other two options, highlighted below:

The first “Banner selection” option allows you to select a particular set of banners from all active “campaigns” that match the banner type for the current zone. Alternatively, you could also specify a list of keywords. phpAdsNew compares these keywords with those associated with individual banners, and displays the ones that match the input criteria. This allows you, as a publisher, to display content-specific banners, thereby increasing the probability of “click-throughs.”

As the names suggests, the “Probability” option allows you to do just that — view the “probability” that a particular banner will displayed for a particular zone. I’ll discuss this further in the following section.

Finally, we have the “InvocationCode” section. You’ve already seen how to generate the code for local invocation in the first part. But, we cannot use this mechanism this time around for obvious reasons. So what’s the solution? Hang on; all will be revealed in due course.

Before I move to the next section, here’s one final tip. You can view a list of all “zones” for a particular publisher by clicking on the “Overview” option, displayed alongside each publisher in the “Publishers & zones” sub-section.

This screen gives you quick access to all the options discussed above; it’s just one of those little things that makes the GUI of phpAdsNew, a breeze to use!

{mospagebreak title=Advertisers Revisited}

Now that we’ve tackled the publisher, it is time to focus on the most important piece of the phpAdsNew jigsaw: the paying advertiser.

In the first part, I showed you how to add an “advertiser,” configure a “campaign” and upload a “banner,” which, in turn, will be linked with the compatible “zones” created by the publisher(s).

Click on the “Add new campaign” hyperlink to view the following screen:

You should already be familiar with the concept of “AdClicks” and “AdViews.” The screen shown above allows you to enter specific numbers, as it is common for Web masters to charge advertisers on the basis of these parameters.

Next, you can customize the “Activation” and “Expiration” dates for your campaign. No great shakes here. However, the next option, Priority, deserves special attention.

No points for guessing that this controls the manner in which the banners associated with the campaign are displayed. The options listed on the screen are pretty self-explanatory; however, you may want to take note of the “Campaign weight” parameter. The higher the value for a particular campaign among all “low priority” campaigns, the more likely that an associated banner will be displayed. This is just the kind of fine-tuning that you may need to meet the requirements of quirky advertisers!

The “Linked Zones” tab displays the publishers and zones that are compatible with the banners that can be associated with the current campaign. You will add the actual banners in the next step. Finally, the “Banner overview” screen displays all the “banners” that you (or the advertiser) have uploaded for the current campaign:

You’ve already seen the “Add new banner” screen in action. However, what I conveniently chose to skip were the different banner types that you can add. Now, click on the link to view a neat little drop down with the following options:

  • Local banner (SQL): the most-commonly used option. It allows you to upload an JPEG or GIF image or Flash SWF file for the banner. There are some pitfalls associated with the use of Flash SWF files; you can find more information in the documentation that ships along with phpAdsNew.

  • External banner: a convenient option if your advertiser opts to store banner images on his Web servers. All you need to do is point the banner to the URL of the required image file.

  • HTML banner: this option allows you to enter HTML code for a banner. It comes in handy if the advertiser would like to display a simple HTML form in the banner.

  • Text banner: this option displays plain, vanilla text. While it may be frowned upon by the creative among you, the overwhelming popularity of the Google AdSense program has rekindled huge interest in this delivery format.

Take your pick, or rather, your advertiser’s pick, and proceed to add banners for the current campaign.

As you saw earlier for the zones, you have a “Campaign overview” screen that allows you (or the advertiser) to review the details of a particular campaign. Take a look:

On this screen, you can quickly add a new banner, review the “AdClicks” and “AdViews” for each active campaign, view/hide inactive campaigns and so on.

{mospagebreak title=Many Websites, One phpAdsNew}

It is common knowledge that a Web entrepreneur is always looking for ways to leverage his existing infrastructure. Take Google, for example: it started with a search engine, then, it launched Froggle and more recently, it added email to its portfolio in the form of Gmail. You get the picture!

If you are a part of this group – and, more importantly, have many “popular” websites, it does not make sense to have multiple local instances (one for each website) of phpAdsNew on your server. In such a scenario, you are better off installing phpAdsNew at a custom URL –

As usual, I’ll give you step-by-step instructions on how to go about this transformation. For starters, you’ll need to unzip the phpAdsNew source code archive at a convenient location under the root folder of your Web server, as I’ve done below:

$ cd /www/htdocs/

$ tar -xzvf /tmp/phpAdsNew-2.0.4-pr2.tar.gz

$ mv phpAdsNew-2.0.4-pr2 phpads

Next, you need to configure your Web server. I’ll assume (as I did in the first part) that you are using Apache. As you may be aware, this Web server supports the concept of Virtual Hosts; for the uninitiated, this feature allows a single Apache instance to host several websites, simultaneously.

Coming back to phpAdsNew, consider the following scenario: you own a Web site accessible at Next, you would like to add a couple more – a new website (say, and the phpAdsNew application, set up so that its administration module can be viewed at

This is not a problem. Just fire up your favorite text editor and load the “httpd.conf” file, which controls configuration of your Apache Web server. Add the following line of code:

NameVirtualHost *:80

Note that this may already be present in your file – just uncomment the instructions by removing the “#” character at the beginning of the line. Next, insert these VirtualHost directives to configure the different websites that I’ve listed above:

DocumentRoot /www/htdocs/mysite
ErrorLog logs/mysite-error.log
CustomLog logs/mysite-access.log common

DocumentRoot /www/htdocs/mynewsite
ErrorLog logs/mynewsite-error.log
CustomLog logs/mynewsite-access.log common

DocumentRoot /www/htdocs/phpads
ErrorLog logs/phpadsnew-error.log
CustomLog logs/phpadsnew-access.log common

Note that you may have to configure the DNS server to map IP addresses to the appropriate URLs. If this sounds like Greek and Latin to you, it’s time to seek the assistance of the server administrator of your Web server.

Now, let me give you a quick run-down of the “VirtualHost” directives that I’ve listed above. For obvious reasons, the IP addresses are different for each block because the Web server has been configured to serve more than one IP address. Another important point to note is the path specified in the “DocumentRoot” directive in each block. The more discerning amongst you will notice that this points to the root folder of the corresponding website.

Restart the server and load the following URL: If all goes well, you should see the familiar administration module of phpAdsNew.

Note that first-time installers will see the default installation wizard in the browser. Just follow the steps outlined in the first part of this tutorial and voila – phpAdsNew should be up and running in no time!

Would you like to learn more about Virtual Hosting? Just point your browser to and if you are still not satisfied, the official Apache documentation has a complete section devoted to this topic:

{mospagebreak title=Remote Calling}

In the first part, I showed you how to display banners on your website using the “local” mode. This works well when you have installed phpAdsNew at a location relative to the root folder of your website. Needless to say, this doesn’t work under our new set up!

Since we have installed phpAdsNew under the root folder of your Web server (and not the website), you’ll have to opt for the “Remote Invocation for JavaScript” method. Sounds confusing? No problem; we’ll do this step-by-step.

Navigate to the “Zone overview” sub-section of phpAdsNew under the “Publishers & zones” section. Here you’ll notice that there is a link titled “Invocationcode” for each zone in the listing.

Let’s assume that you have two zones for a particular “publisher” (a.k.a. website), a horizontal “IAB Leader Board (728 x 90)” zone and a vertical “IAB Skyscraper (120 x 600)” zone.

Click on the link for each zone to view the following screen:

From the drop down, select the “Remote Invocation for Javascript” option. Next, you’ll notice the same parameters that I’ve discussed in part one. Let me inject a little note of caution here; you may want to enable the display of more than one banner from the same campaign if you have multiple banners types for a single advertiser, as in our case.

Next, click on the “Generate” button to generate the code snippet that you need to insert into your PHP scripts or HTML code. Take a peek at the following code listing that integrates the code snippet in a sample PHP script (say “index.php”):

 <BASEFONT face=”Arial”>
<TABLE width=”100%” border=”2″ cellpadding=”10″ cellspacing=”0″>
  <TD width=”25%”>
  <TD align=”center” valign=”middle”>


  <TD width=”100%” colspan=”2″>

   <!– code for Horizontal Banner –>
   <script language=’JavaScript’ type=’text/javascript’>
   if (!document.phpAds_used) document.phpAds_used = ‘,’;
   phpAds_random = new String (Math.random()); phpAds_random = phpAds_random.substring(2,11);
   document.write (“<” + “script language=’JavaScript’ type=’text/javascript’ src='”);
   document.write (“http://” + phpAds_random);
   document.write (“&amp;what=zone:2”);
   document.write (“&amp;exclude=” + document.phpAds_used);
   if (document.referer)
      document.write (“&amp;referer=” + escape(document.referer));
   document.write (“‘><” + “/script>”);
</script><noscript><a href=’http://′ target=’_blank’><img src=’;n=ac36ac73′ border=’0′ alt=”></a></noscript>
<!– End of Horizontal Banner –>


 <TR height=”80%”`>
  <TD align=”center” valign=”center” width=”75%”>
   Content comes here
  <TD align=”center” valign=”top” width=”25%”>
   <!– Code for Vertical banner –>
<script language=’JavaScript’ type=’text/javascript’>
   if (!document.phpAds_used) document.phpAds_used = ‘,’;
   phpAds_random = new String (Math.random()); phpAds_random = phpAds_random.substring(2,11);
   document.write (“<” + “script language=’JavaScript’ type=’text/javascript’ src='”);
   document.write (“” + phpAds_random);
   document.write (“&amp;what=zone:4”);
   document.write (“&amp;exclude=” + document.phpAds_used);
   if (document.referer)
      document.write (“&amp;referer=” + escape(document.referer));
   document.write (“‘><” + “/script>”);
</script><noscript><a href=’’ target=’_blank’><img src=’;n=a5b0b59a’ border=’0′ alt=”></a></noscript>
<!– End of Vertical banner –>

Load this example in your browser to view the following output:


As you can see, this was pretty easy; a simple cut-copy-paste operation was all that was required to integrate the banners with your website. Furthermore, you do not need to worry about some complex PHP code, as was the case with the “local” mode of invocation.


That’s it for this part of the phpAdsNew tutorial. Let me give you a quick review of the topics that I covered in today’s article. I gave you more information about the add-on features of the “Publishers” and “Advertisers” modules, which should help you to fine-tune the application to meet your requirements. Next, I showed you how to configure Virtual Hosts on your Apache server, so that you can install phpAdsNew at its own unique URL. Finally, I showed you how to use the “Remote Invocation for Javascript” method to display banners, which helps you to integrate phpAdsNew with multiple websites on the same server, as well as any third-party website (on another server).

In the concluding part, I promise, I will throw light on the less attractive – but more important – “Statistics” and “Reports” sections of the tool. I will also show you how to reconfigure phpAdsNew from the “Settings” section.

Till then, stay healthy!

Note: All examples in this article have been tested on Linux/i586 with Apache 1.3.12, MySQL 3.23 and PHP 4.3.1. Examples are illustrative only, and are not meant for a production environment. YMMV!

[gp-comments width="770" linklove="off" ]

chat sex hikayeleri Ensest hikaye