Different code with every 2nd and 3rd item in the collection (increment-tag, mod-modifier) #7038
-
Hi, In my project, I have a collection of cases where the lay-out differs related to the position they're on. The first case should be full width, the second and third half width, then again full width, half width, half width, and so on.. It works when I hard code it, like this:
However, I want the now hard coded integers as variables. I've tried using Then I tried using the mod-modifier on the count like:
The What is a good solution for this? I have quite a lot cases, so I don't want to put in all the right numbers of the 2nd and 3rd positions. Appreciate the help. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Try surrounding the modifiers inside the conditions with parenthesis instead: {{ if (count|mod:3) == 1 }}
{{ elseif (count|mod:3) == 2 }}
{{ elseif (count|mod:3) == 0 }}
{{ /if }} |
Beta Was this translation helpful? Give feedback.
Try surrounding the modifiers inside the conditions with parenthesis instead: