I'm trying to create a scrolling marquee that scrolls random images including links. Unfortunaltey I keep running into problems with each of my loops!
There are several arrays (1 per image) that contains height, width, title, image-url & link-url. I'm trying to get these images to all appear on the page, but in a random order each time the page is loaded. For simplicities sake I have only included 3 arrays, but the idea is that there could be any number.
I was kind of hoping someone could take a look at the following & let me know how to fix it. (please note there are several loops that have been commented out where I have been trying to fix this myself).
There are several arrays (1 per image) that contains height, width, title, image-url & link-url. I'm trying to get these images to all appear on the page, but in a random order each time the page is loaded. For simplicities sake I have only included 3 arrays, but the idea is that there could be any number.
I was kind of hoping someone could take a look at the following & let me know how to fix it. (please note there are several loops that have been commented out where I have been trying to fix this myself).
Code:
<?php
$startnum = 1;
$endnum = 3;
$items = array(
1 => array(
'href' => 'dragon.php',
'title' => 'Dragon',
'src' => 'includes/images/misc/alfa-146-jtd.jpg',
'alt' => 'Dragon',
'width' => '100',
'height' => '100'),
2 => array(
'href' => 'forte.php',
'title' => 'forte',
'src' => 'includes/images/misc/forte.jpg',
'alt' => 'Forte',
'width' => '110',
'height' => '80'),
3 => array(
'href' => 'castrol.php',
'title' => 'castrol',
'src' => 'includes/images/misc/castrol.jpg',
'alt' => 'Castrol',
'width' => '115',
'height' => '50'),);
$item = $items[rand($startnum,$endnum)];
//foreach ($items as $value) {
//echo '<tr><td class="infoBoxContents" valign="top"></td><td class="infoBoxContents"><center>';
//echo '<a href="' . $item['href'] . '" title="' . $item['title'] . '"><img src="' . $item['src'] . '" alt="' . $item['alt'] . '" width="' . $item['width'] . '" height="' . $item['height'] . '"></a>';
//echo '<br><br><br><br></center></td></tr>';
//};
//$ourrandnum = $item;
//
//
//for ($item; $item<=$endnum; $item++)
//{
//echo '<a href="' . $item['href'] . '" title="' . $item['title'] . '"><img src="' . $item['src'] . '" alt="' . $item['alt'] . '"></a>';
//}
//;
//
//do {
//echo '<a href="' . $item['href'] . '" title="' . $item['title'] . '"><img src="' . $item['src'] . '" alt="' . $item['alt'] . '"></a>';
//$item = $item++;
//}
//while ($item<$endnum);
?>