BannerClasses

BannerFolder was nice, but lacked a few features I needed. Additionally, it had a problem when no banners had remaining views; it would hang. I decided to implement my own, picking up where I left off when I found BannerFolder. This is only the first step in along process of providing a full banner advertisement management system.

Comments, etc. should be addressed to Bill Anderson. If it is a bug report, please include the Zope Version and setup, as well as any relevant tracebacks.

Introduction

This is a brief introduction to what and why regarding BannerClasses.

The Classes

The classes are intended to be used as building blocks. An example implementation is included, and happens to be useable.  

Banner Base Class

The Banner Base Class is used for building Banner Objects. The Banner object in the included example was built by subclassing from Banner Base Class and Image.

In this version, this class defines one method: show().   

Show()

The Show method does all the work. It decrements the views_remaining, increments the views, and determines it's type. It then returns either the image wrapped in a link, or the code for a remote banner, as specified by the banner. Currently, it doesn't take any options.  

Banner Manager Base Class

This class is useful for designing Banner Ad managers. It is meant to be sublassed, and used as a building block, providing the functionality of randomly selecting a banner from itsself, and displaying the banner.

Currently, it is capable of detemrining the weights of the various banners, and randomly choosing with that in mind. It will filter out banners with no remaining views. When none of the banners have any views available, it will return an html comment, telling you it's name, and that it has no banners available. :)

This Class defines two methods: render() and get_banner(). Neither take options at this time, and currently, they are twins. This was done to provide a renderable object, giving you the same functionality as BannerFolder. :)

The Ad Manager included with this download was built by subclassing (in order):

  • Renderable
  • Banner Manager Base Classs
  • ObjectManager   

    get_banner()

    get_banner() will randomly select a banner from the Ad Manager.

    Using The Included BannerSystem.zexp

     

    Ad manager

    The included export is an example of how to build a basic banner system, and has the added benefit of being useable, out of the box. :)

    To use, I reccomend you create an Ad Manager in your root folder, called hbanner. You can us eany title you like, but I have prefer to split into two Ad Managers, one for vertically oriented banners, and one for horizontally oriented ads. I create a vbanner, and an hbanner, and thus can have them both at my displosal.

    Inside this Ad Manager, you can add banners till your heart is content, or your Data.fs is full, whichever comes first. :) Currently, the Ad manager only contains banners, and randomly selects one. In the future, it will have reports, and other features.  

    Banner Ad

    The BannerClass provides an Banner object, called Banner Ad. The Banner ad can be used anywhere, but is best placed inside an Ad Manager.

    Adding a Banne rAd is fairly self-explanatory. When Added, there is an admin tab called 'Show Banner'. This tab will show the banner, regardless of type, without changing the stats.

    Caveats

    Currently, the Banner System uses the ZODB to store all data. In the future this will be an option. In the meantime, you will want to keep an eye on the Data.fs size, as it will grow. Packing the database will shrink it significantly.

    This first version is part of the release early and often philosophy. As such, I must classify it as beta, even though the code is at least as stable as BannerFolder (other than the zero-remaining views bug, of course ;). Basically, this means that while it seems to be quite stable in it's present form, it will be undergoing changes in the future as features are added, and the system tightened up. As such, upgrade paths may not be available.