> I created a few more codes than you suggested
Yeah, I had these as well, bute removed half of them, because we will rotate the options anyway.
> First of all, these codes refer to pages, correct?
No, this is about images. You can either "decode" the image names later, acutally using A1 to D3 oder you can place the filenames of the images instead of the A1, A2, ...
I think replacing them later is the more elegant solution.
> and added a PHP code looking like this :
Ah, I told you something wrong. You do not need valueList() but value(..., 'csv'), so
$code1 = value('RG01', 'csv');
$code2 = value('RG02', 'csv');
$code3 = value('RG03', 'csv');
$code4 = value('RG04', 'csv');
$allImages = array_merge($code1, $code2, $code3, $code4);
> I hope I managed to write it correctly!
Add this line to get an impression:
debug($allImages);
> how to actually display these pictures
First, make sure not to shuffle this again, and again. Replace the shuffle() line as follows:
if (!isset($allImages)) {
shuffle($allImages);
registerVariable($allImages);
}
Then we need a replacement for the images:
$images = [
'A1' => 'firstimage.jpg',
'A2' => 'secondimage.jpg',
...
'D3' => 'lastimage.jpg'
];
Then let's just walk the array:
$imageID = loopPage($allImages);
$image = $images[$imageID];
html('<div><img src="'.$image.'" alt="" style="max-width: 100%"><&/div>');
That would be the appropriate code to just display the images.
> so I can add questions to this page.
If you want to show the images with questions, then actually create 12 pages with the images and questions, given them page IDs A1, A2, ... D3, and instead of defining the $images array (and everything else) just show the images.
setPageOrder($allImages, 'SD');
'SD' would be the page ID of the page that follows the D3 page.