SOHO : Small Office Home Office
Freeware - Opensource software tips, tricks, tweaks & fixes for managing, securing, improving the performance of SOHO Desktop, Laptop, Networks

Thursday, August 19, 2010

Simple Ad Rotator PHP script

Overview: Creating a simple ad-rotator, the ads are stored in a text file and picked randomly by this PHP code.

Most of the webmaster use banner ads, we will be creating a very simple banner rotator, which picks up randomly one ad from the banner file and displays it, this file can be called in any other page to display the banners.

We will be storing banner ads in a text file banner_ads.txt

banner_ads.txt

Note that the banners are seperated by ~ in our banner file.










ad_rotator.php

The above 'ad_rotator.php' can be included in any PHP page to display a banner ad by using include 'ad_rotator.php'; tag wherever banner is required.

The above concept can be also be used to display random quotes etc, just modify the banners_ads.txt with the random content you want.


1 comment:

  1. Hey that's really a great post and a wonderful description out here, I really like the way things are being executed and discussed here.

    Classifieds Php Script

    ReplyDelete