Template Categories

templates categories Automobiles
templates categories Business
templates categories CSS Templates
templates categories E-Commerce
templates categories Education
templates categories Fashion
templates categories Greeting Cards
templates categories Hotels
templates categories Jewelry
templates categories kids
templates categories Models
templates categories Music - Films
templates categories Night Club
templates categories Real Estate
templates categories Restaurant
templates categories Software
templates categories Sports
templates categories Travel
templates categories Web-design
templates categories Wedding

Tutorial Categories

tutorial categories AJAX
tutorial categories CSS
tutorial categories Dreamweaver
tutorial categories Flash
tutorial categories FTP - File Transfer
tutorial categories HTML Emails
tutorial categories Javascript
tutorial categories Microsoft Excel
tutorial categories Microsoft Windows
tutorial categories Microsoft Word
tutorial categories MySql
tutorial categories Photoshop
tutorial categories Php
tutorial categories Windows Movie Maker
tutorial categories Xhtml / Html

Simple PHP banner rotation script


<?php
$Ad[1] = 'path to banner image one';
$Ad[2] = 'path to banner image two';
$Ad[3] = 'path to banner image three';
$adTotal = count($Ad);
$randomAdnum = mt_rand(1, $adTotal);
echo $Ad[$randomAdnum];
?>

The Explanation

$adTotal counts the total number number of image ads. These image ads can be hyperlinked to open seperate webpages. Once the number od ads is determined the same is then set to a variable $randomAdnum which in turn also generates ramdom ad.

Finally, the echo statement shows the image as per the random number generated.

Here is the code with the image code: -


$Ad[1] = '<img src="ad1.gif" width="490" height="75" border="0" />';