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