DISPLAY IMAGES RANDOMLY - Aug 3rd, 2010


If you want to randomize how your images are displayed each time your page is reloaded you can shuffle your array first:



<?PHP shuffle($record['gallery_images']) ?>
<?PHP foreach ($record['gallery_images'] as $upload): ?>
<img src="<?PHP echo $upload['thumbUrlPath'] ?>" width="<?PHP echo $upload['thumbWidth'] ?>" height="<?PHP echo
$upload['thumbHeight'] ?>" alt="" />
<!-- Optional Code -->
<?PHP break ?>
<!-- End Optional Code -->
<?PHP endforeach ?>



The <?PHP break ?> stops the foreach loop so that only a single image is displayed.

Cool huh!!



The materials on this web site have been created for use with CMS Builder content management software. CMS Builder software is published and licensed for use by InteractiveTools.com. Please contact Interactive Tools for information on the downloading of the software or the purchasing of licenses.


Terms of Service