Random Advertising Banner Rotation
Advertising banners are the highway billboards of the web. The implementation of banners has been greatly simplified in iHTML. This example will discuss how to display a random banner every time a page is loaded.


 
Table Set-up
Have a database table set up with information relating to the advertiser. Since we use iRANDOM for this example, the table must contain an id, weight, and output field. The weight value influences the chances of a banner being displayed (consider it a ratio), which is a useful feature for the implementation of variable advertising prices. For this example, we will use the image file name for the output. We will also have fields for the destination URL, and the number of times that graphic has been viewed (a useful reporting figure).
idweightoutputURLHits
11inline.gifhttp://www.inline.net62
21ihtml.gifhttp://www.ihtml.com59
 
Example (reload the page to test)

`http://www.excite.com`
 
Implementation

Create a directory for your graphics (eg. 'ads'). This directory should contain all of the advertising banner graphics (eg. 'ad1.gif', 'ad2.gif'). Add a new entry for each banner in the database, specifying the name of the graphic, and the URL to go to. Then plug the following source code into your documents.

Download the source and Access database.