Professional vBulletin Hosting!

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:
?>

http://www.vbskinstudio.com/wp-content/plugins/sociofluid/images/digg_48.png http://www.vbskinstudio.com/wp-content/plugins/sociofluid/images/reddit_48.png http://www.vbskinstudio.com/wp-content/plugins/sociofluid/images/stumbleupon_48.png http://www.vbskinstudio.com/wp-content/plugins/sociofluid/images/delicious_48.png http://www.vbskinstudio.com/wp-content/plugins/sociofluid/images/blogmarks_48.png http://www.vbskinstudio.com/wp-content/plugins/sociofluid/images/furl_48.png http://www.vbskinstudio.com/wp-content/plugins/sociofluid/images/newsvine_48.png http://www.vbskinstudio.com/wp-content/plugins/sociofluid/images/technorati_48.png http://www.vbskinstudio.com/wp-content/plugins/sociofluid/images/google_48.png http://www.vbskinstudio.com/wp-content/plugins/sociofluid/images/facebook_48.png http://www.vbskinstudio.com/wp-content/plugins/sociofluid/images/yahoobuzz_48.png http://www.vbskinstudio.com/wp-content/plugins/sociofluid/images/twitter_48.png

About admin


Post a comment