Hi All
I'm new to this list and I suppose fairly new to PHP - and hope that
this question is in keeping with the type of thing that's usually asked.
I'm trying to dynamically randomise a chunk of HTML that is used on a
page, aka random image, so that each time a client opens the page [or
refreshes] a part of the page changes.
The chunks of HTML are saved in their own directory as .htm files. I
was hoping to adapt the following code I have managed to cobble together
to display random images:
<?php
// images in folder
$total = "5";
// file type
$file_type = ".htm, .gif, .jpg";
// dir location
$image_folder = "dir/dir";
$start = "1";
$random = mt_rand($start, $total);
$image_name = $random . $file_type;
// print file name
// echo "$image_name";
// display image
// echo "<img src=\"$image_folder/$image_name\" alt=\"$image_name\" />";
?>
I'd like the code to take the HTML and place it in a <div></div>,
probably using a <?php require (""); ?> (I think I'm OK with this once
the code is sorted).
However - I don't seem to be able to progress any further with this -
I'm sure I'm missing something very basic - but I just can't get past
this point.
I'd be grateful for any pointers with this.
TIA
ange
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php