// Tutorials / PHP: Banner Rotation Script

Posted The: 11/05/2008 - AT: 16:23

Edited The: 21/05/2008 - AT: 15:34

Before you read the Tutorial about Banner Rotation, it is recommended that you read Variables in PHP Which includes information about Array's, and finally String Concatenation.

Creating The Script

Can also be used to rotate images

The first Example is really simple, and sufficient in most cases.

<?php

$RandomNumber = rand(1, 10);

echo '<img src="Images/' . $RandomNumber . 'img.jpg">';

?>

The above asume that you already know the name of the images, simply name each image "1img.jpg, 2img.jpg, 3img.jpg" Etc. And then increase the random number accordingly.

The above also works on servers running php in Safe Mode, where the next dosn't. However the next has support for more filetypes, and dosn't require you to rename your images.

Final Example

Writing in progress...

Stumble It!

Author: BlueBoden

Comments: [0]

  1. HTML Tutorial
  2. CSS Tutorial
  3. XHTML Tutorial
  4. RSS Tutorial
  5. PHP Tutorial
  6. htaccess Tutorial
  7. Server Tutorial
  8. SEO Tutorial

Checked At:05:59

5 Guests

0 Users

Online doing the past 15 Minutes!

PageRanking.dk - Flere hits og højere PageRank - GRATIS tilmelding!

This page was created in 0.0440900325775 seconds

Welcome Guest