Hi All Finally the below code I added to page.tpl.php to show different images at on page refresh. In IE8 it is working fine. Howevr with firefox the image is not shownup. Any clue ?
The code is as below.
<!-- Starting banner --> <?php function endswith($string, $test) { $strlen1 = strlen($string); $testlen = strlen($test); if($strlen1 < $testlen) return FALSE; $diff = $strlen1 - $testlen; $strend = substr($string, $diff); return ($strend == $test); } $dirimage = realpath('.\sites\all\themes\myzen\templates\himg'); $directory = opendir($dirimage); $counter = 0; while ( FALSE !== ($file = readdir( $directory )) ) { if(endswith($file, "jpg")) { $counter++; $files[] = $file; } } $counter--; $which = rand(0,$counter) ; $imagepath = $dirimage . "\\" . $files[$which]; ?> <img src="<?php print $imagepath ?>" />
<!-- Ending banner -->