1

I have a stash list for displaying entries. In general a row has 3 columns, but I also want to break with rows of 2 columns.

layout looks like:

30%|30%|30%
30%|30%|30%
50%|50%
30%|30%|30%
30%|30%|30%
50%|50%
30%|30%|30%
30%|30%|30%
50%|50%

{exp:stash:get_list name="dataEntries" prefix="archiveEntriesHomeList" require_prefix="no"}  
    {if archiveEntriesHomeList:count % 7 == 0} DO 50% column
    {if:elseif archiveEntriesHomeList:count % 8 == 0} DO 50% column
    {if:else} DO 30% column {/if}
{/exp:stash:get_list}

but this will not work, since 50% columns should displayed when count is:

7 & 8
15 & 16
23 & 24
31 & 32
and so on...

any idea how to do implement this in a simple way?

1 Answer 1

0

In the first part of the conditional test for modulus of the next number:

{if (count + 1) % 8 == 0 }

So you end up with something like:

{exp:stash:get_list name="test"}  
    {if (count + 1) % 8 == 0 } {count} DO 50% column<br>
    {if:elseif count % 8 == 0} {count} DO 50% column<br>
    {if:else} {count} DO 30% column<br> {/if}
{/exp:stash:get_list}
1
  • you are the man, thx! Commented Aug 15, 2016 at 9:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.