Add rotator or creating banner in PHP
Posted: Sun May 24, 2009 4:25 pm
Hi,
Just I want to create add rotator in my PHP. I have created one as bellow :
banner.php
and I am calling it as :
The problem is that when I load my page, I can see the first add selected from the list but it doen't refresh it( I mean it keeps that add only until when I refresh my page). When I hit refresh or reload button it picks another advert. now, How can make rotating through all the adds without hitting refreshing or using <META REFRESH > tag?
Thank you.
Just I want to create add rotator in my PHP. I have created one as bellow :
banner.php
Code: Select all
<center>
<?php
$Img1 = "Images/image1.jpg";
$Alt1 = "Jean Baptiste MINANI";
$Url1 = "http://www.chezjeanbaptiste.com";
$Img2 ="Images/image2.jpg";
$Alt2 = "We advertise for you";
$Url2 = "http://www.kist.ac.rw";
$Img3 ="Images/image3.jpg";
$Alt3 = "We advertise for you";
$Url3 = "http://www.kist.ac.rw";
$num = rand(1,3);
$Image = ${'Img'.$num};
$Alt = ${'Alt' .$num};
$URL = ${'Url'.$num};
echo '<a href="' . $URL . '"><img src="' . $Image . '" width="200" height="150" alt="'.$Alt.'"> </a>';
?>
</center>Code: Select all
<div id="photo">
<?php include 'banner.php'; ?>
</div>The problem is that when I load my page, I can see the first add selected from the list but it doen't refresh it( I mean it keeps that add only until when I refresh my page). When I hit refresh or reload button it picks another advert. now, How can make rotating through all the adds without hitting refreshing or using <META REFRESH > tag?
Thank you.