Hi,
In my controller I made a variable[] and inside it there is all the event pages which are before today.
This variable is called $events_events_past .
So I want to get all images that are inside a specific structure field in all these pages.
And then I want to shuffle them all.
If i do this :
<?php foreach($events_events_past as $event): ?>
<?php $event_photographies = $event->photographies()->toStructure() ?>
<?php foreach ($event_photographies as $event_photography): ?>
<?php echo $event_photography ?><br>
<?php endforeach ?>
<?php endforeach ?>
I get the list that Iām looking for :
a-image1.jpg
a-image2.jpg
a-image3.jpg
a-image4.jpg
a-image5.jpg
b-image1.jpg
b-image2.jpg
b-image3.jpg
c-image1.jpg
c-image2.jpg
c-image3.jpg
c-image4.jpg
ā¦
If I had the shuffle :
<?php foreach($events_events_past as $event): ?>
<?php $event_photographies = $event->photographies()->toStructure() ?>
<?php foreach ($event_photographies->shuffle() as $event_photography): ?>
<?php echo $event_photography ?><br>
<?php endforeach ?>
<?php endforeach ?>
It mix all images by page and not all together like I would like :
a-image5.jpg
a-image1.jpg
a-image3.jpg
a-image4.jpg
a-image2.jpg
b-image1.jpg
b-image3.jpg
b-image2.jpg
c-image4.jpg
c-image3.jpg
c-image2.jpg
c-image1.jpg
ā¦
No surprise Iām noob with php, for many hours I tried to do it with merge, array_merge etc.
Now Iām asking for help,
Thanks already !