Detail Page Random Upload

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

By s2smedia - June 28, 2017

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!

By Damon - June 29, 2017

Hi,

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!

Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/