Browse > Home / Webmaster Tutorials / PHP Banner Rotation System

| Subcribe via RSS

PHP Banner Rotation System

May 30th, 2009 Posted in Webmaster Tutorials

This is a small and handy tutorial that explains an easy way to setup some banners to display in rotation on your website. There are no special requirements, the only thing that is needed is PHP enabled on the server (All servers got this by default)

Put this code at the top of your file where you want the banner rotation to be displayed (eg: index.php)

<?php
$banner = array();
$banner[] = ‘<a href=”http://www.website1.com“><img src=”images/banner1.gif” alt=”Website1″ /></a>’;
$banner[] = ‘<a href=”http://www.warezteacher.com“><img src=”images/banner2.gif” alt=”Warezteacher” /></a>’;
shuffle($banners);
?>

Then in the same file where you want to display the banners in rotation you put the following code:

<?php
echo $banner[0];
?>

HINT:
*Make sure the file is saved as *.php
*Make sure you put the correct path to the image.

Enjoy!

No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.

One Response to “PHP Banner Rotation System”

  1. payday loan lenders Says:

    I found warezteacher.com very informative. The article is professionally written and I feel like the author knows the subject very well. warezteacher.com keep it that way.


Leave a Reply

You must be logged in to post a comment.