Random Image banner Rotater
Category : vbulletin-and-coding-guides
Random Image/Banner Rotater
1.) Get some images and put them in a folder called images and then upload them to your webserver.
2.) Open a php editor or notepad/wordpad and type in the php starting tag:
PHP Code:
<?php 3.) Now to set up your images array:
PHP Code:
$images = array
(
1 =>'images/yourfile.png',
2 =>'images/yourfile.png',
3 =>'images/yourfile.png',
4 =>'images/yourfile.png',
5 =>'images/yourfile.png',
6 =>'images/yourfile.png',
7 =>'images/yourfile.png',
8 =>'images/yourfile.png',
9 =>'images/yourfile.png',
0 =>'images/yourfile.png',
);
4.) Now you have to pick a random number:
PHP Code:
$imagecounter = RAND(0, 9);
This picks a random number between 0 and 9.
5.) Now you have to put that number to use and select one of the values out of the array as well as echoing it out:
PHP Code:
echo "<img src="" . $images[$imagecounter] . "">;
6.) End the php tags:
PHP Code:
?>














