Quote:
Originally Posted by Mr-Moo
You would have to add something like this to and have it included into your header:
PHP Code:
<?php
function getRandomFromArray($ar) {
mt_srand( (double)microtime() * 1000000 );
$num = array_rand($ar);
return $ar[$num];
}
function getImagesFromDir($path) {
$images = array();
if ( $img_dir = @opendir($path) ) {
while ( false !== ($img_file = readdir($img_dir)) ) {
// checks for gif, jpg, png
if ( preg_match("/(\.gif|\.jpg|\.png)$/", $img_file) ) {
$images[] = $img_file;
}
}
closedir($img_dir);
}
return $images;
}
$root = '';
// If images not in sub directory of current directory specify root
//$root = $_SERVER['DOCUMENT_ROOT'];
$path = 'forum/images/stylename/newlogos';
// Obtain list of images from directory
$imgList = getImagesFromDir($root . $path);
$img = getRandomFromArray($imgList);
?>
Then wherever your header image is place this:
PHP Code:
<img src="<?php echo $path . $img ?>" alt="" />
Or at least assign the above snippet code as a Vb template code and display this in your style.
I think I explained it correctly, if anyone else can elaborate please do as my thoughts sometime scatter
Hope this helps. Let me know if it does!
|
Other than the fact you can't put php into the templates you nailed it right on :erm:
You'll have to make a plugin at global_start more than likely and give whatever the script outputs a value and then use it in your template