Yesterday I came across this excellent tutorial to display Random Images. I also tried it and implemented it on this site.
1. I use bluemarine theme for this site. I created a folder "images" and uploaded three images in there.
themes/bluemarine/images
header_1.jpg
header_2.jpg
header_3.jpg
2. Modified "page.tpl.php" and added the following code
-
<img src="/themes/bluemarine/images/header_<?php echo(rand(1,3)); ?>.jpg" alt="Ravi Sagar" / id="random_header">
3. Modified "style.css" and add section to handle "random_header"
-
#random_header {
-
float: left;
-
width: 900px;
-
height: 170px;
-
}
Thats it! it is simple and it looks good. Now every time page is refreshed a new Image is displayed!!