Hi
I’m using the file extension to allow users to upload multiple images at once. I need to use a switch in the outputted template to assign a class to every third image, but for some reason the last image in the array resets the count to 1.
So if I upload three images, the output
{count}
reads 1,2,1
The switch is also therefore affected - if I have
class="{switch="classone|classtwo|classthree"}"
the output goes classone, classtwo, classone
Can anyone help? I’ve looked at the source code but the only relevant line I can find is this:
'count' => $count+1,
Thanks in advance 😊
Hey,
I had the same problem, and I think I have found a solution. I think the trouble occurs in the lines where the array is flipped and flipped back again.
I changed line 1223 from:
'count' => $count+1,
to
'count' => $count,
and after line 1237, which reads:
$var = array_flip($var);
I added:
$var['{count}']++;
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.