random image order
3 posts by 2 authors in: Forums > CMS Builder
Last Post: March 2, 2012 (RSS)
By zaba - March 1, 2012
I am trying to load images in a gallery, but i would like the order they appear (each time you visit the page) to be different (random).
in cmsb they are in 1 table called 'gallery', and they are all resident in the field named 'images'.
what would the output code be?
in cmsb they are in 1 table called 'gallery', and they are all resident in the field named 'images'.
what would the output code be?
Re: [zaba] random image order
By Jason - March 1, 2012
Hi,
If you want to randomize the order of images for an individual gallery record, you can use the php function shuffle().
For example:
Hope this helps
If you want to randomize the order of images for an individual gallery record, you can use the php function shuffle().
For example:
<?php shuffle($record['images']); ?>
<?php foreach ($record['images'] as $image): ?>
//output image
<?php endforeach ?>
Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Re: [Jason] random image order
By zaba - March 2, 2012
Thanks Jason for your speedy response,
i'll give this a shot.
Much appreciated!
i'll give this a shot.
Much appreciated!