/ Published in: PHP
This randomly displays 1 of the 5 arrays (amount of arrays to choose from can be reduced or increased)
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/* Inspired by Simple randomizer. Roger Johansson, http://www.456bereastreet.com/ */ echo '<div class="name">' . "\n"; 'href' => 'link.html', 'title' => 'text', 'src' => 'image-1.jpg', 'alt' => 'text' ), 'href' => 'link.html', 'title' => 'text', 'src' => 'image-2.jpg', 'alt' => 'text' ), 'href' => 'link.html', 'title' => 'text', 'src' => 'image-3.jpg', 'alt' => 'text' ), 'href' => 'link.html', 'title' => 'text', 'src' => 'image-4.jpg', 'alt' => 'text' ), 'href' => 'link.html', 'title' => 'text', 'src' => 'image-5.jpg', 'alt' => 'text' ) ); echo "\t" . '<a href="' . $item['href'] . '" title="' . $item['title'] . '"><img src="' . $item['src'] . '" alt="' . $item['alt'] . '"></a>' . "\n"; echo '</div>' . "\n";