2
Ok, I've given up on my idea. I've now tried adapting the code from the index.php file of the RandomBabe module which randomly displays GIF and JPG images. I placed this code in my theme.html file to try and get it to display a random picture;
Quote:
<{php}>
mt_srand((double)microtime()*1000000);
$imgs = dir('path/to/images');
while ($file = $imgs->read()) {
if (eregi("gif", $file) || eregi("jpg", $file)) {
$imglist .= "$file ";
}
}
closedir($imgs->handle);
$imglist = explode(" ", $imglist);
$a = sizeof($imglist)-2;
$random = mt_rand(0, $a);
$image = $imglist[$random];
$asin = explode(".", $image);
<{/php}>
It doesn't work so I've obviously overlooked something as my PHP skills are fairly basic. Can anyone point out to me where I'm going wrong, or better yet if there is another/easier way of displaying random image files in my theme.html file?