Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End How Do They Do It? (Banner Rotation) Re: How Do They Do It? (Banner Rotation)

#61965
TheDoc
Member

I’m a huge fan of PHP for this. So much so that I’m moving this topic to the PHP section!

You can simply use the rand() function to achieve the results. Here’s a really simple explanation:

http://php.about.com/od/finishedphp1/qt … banner.htm

Essentially, it’ll be something like this:

<?php
$num = rand(1, 5);
?>

<img class="classname" alt="" src="images/banner-<?php echo $num; ?>.jpg" />