I try to randomly shuffle the items of a repeatable, but my approach does not work:
Any ideas, how I could solve it?
- Code: Select all
<cms:repeatable name='photos'>
<cms:editable name='photo'type='image' />
</cms:repeatable>
<div class="gallery">
<cms:show_repeatable 'photos'>
<cms:php>
$photos = array('<img class="card" src="<cms:show photo />">');
</cms:php>
</cms:show_repeatable>
<cms:php>
shuffle($photos);
foreach ($photos as $photo) {
echo $photo;
}
</cms:php>
</div>
Any ideas, how I could solve it?