Administration
  Home arrow Administration arrow Page 5 - Banner Management With phpAdsNew (Part two)
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
Google.com  
ADMINISTRATION

Banner Management With phpAdsNew (Part two)
By: Harish Kamath
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 7
    2005-04-11


    Table of Contents:
  • Banner Management With phpAdsNew (Part two)
  • Publishers Revisited
  • Advertisers Revisited
  • Many Websites, One phpAdsNew
  • Remote Calling

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Banner Management With phpAdsNew (Part two) - Remote Calling
    ( Page 5 of 5 )

    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"):

    <HTML>
    <HEAD>
     <TITLE>My Site</TITLE>
     <BASEFONT face="Arial">
    </HEAD>
    <BODY>
    <TABLE width="100%" border="2" cellpadding="10" cellspacing="0">
     <TR>
      <TD width="25%">
       LOGO
      </TD>
      <TD align="center" valign="middle">

       SOME HEADER TEXT HERE


      </TD> 
     </TR>
     <TR>
      <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:// ads.mysite.com/adjs.php?n=" + 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:// ads.mysite.com/adclick.php?n=ac36ac73' target='_blank'><img src='http://ads.mysite.com/adview.php?what=zone:2&amp;n=ac36ac73' border='0' alt=''></a></noscript>
    <!-- End of Horizontal Banner -->

      </TD> 
     </TR>

     <TR height="80%"`>
      <TD align="center" valign="center" width="75%">
       Content comes here
      </TD>
      <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 ("
    http://ads.mysite.com/adjs.php?n=" + 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='http://ads.mysite.com/phpadsnew/adclick.php?n=a5b0b59a' target='_blank'><img src='http://ads.mysite.com/adview.php?what=zone:4&amp;n=a5b0b59a' border='0' alt=''></a></noscript>
    <!-- End of Vertical banner -->
      </TD>
     </TR> 
    </TABLE>
    </BODY>
    </HTML>

    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.


    Conclusion

    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!



     
     
    >>> More Administration Articles          >>> More By Harish Kamath
     

       

    ADMINISTRATION ARTICLES

    - Network Booting via PXE: the Basics
    - Scalix: Linux Administrator`s Guide
    - Network Administration with FreeBSD 7
    - Components of an Information Architecture
    - The Anatomy of an Information Architecture
    - Configuring Load-Balanced Clusters
    - Load-Balanced Clusters
    - UNIX Time Format Demystified
    - Making Changes in the CVS
    - Building Your First CVS Repository
    - CVS Quickstart Guide
    - Authorizing Users in Samba
    - Handling User Accounts in Samba
    - Authentication in Samba
    - Accounts, Authentication, and Authorization





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek