2 posts by 2 authors in: Forums > CMS Builder
Last Post: June 29, 2017   (RSS)

I know how to get a random record to show for a List Page.. but I cant figure out how to show uploads in a random order on a details page.. thanks for the help in advance!


On the detail page, to show uploaded images in a random order, use the shuffle() function. 

Here is an example of the code:

<?php shuffle($newsRecord['image']); ?>
<?php foreach ($newsRecord['image'] as $index => $upload): ?>
<img src="<?php echo htmlencode($upload['thumbUrlPath']) ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" />
<?php endforeach ?>

Hope this helps!

Damon Edis

Hire me! Save time by getting our experts to help with your project.