Problems, need help? Have a tip or advice? Post it here.
6 posts Page 1 of 1
In one page, my graphic designer, would display several images organized by rows and columns. It's possible with show_repeatable to control the number of loops to divide the content by rows?

Example, I have rows each made by 3 images. If I insert exactly 3 images, only 1 row is needed, but if I insert 6 images, there are 2 rows each made by 3 images, and so on. So, how I can split repeatable loop?

Thanks...
Hi, place <cms:dump /> inside <cms:show_repeatable > pair and you'll see whether it has k_count variable. It could help with some math. :)
Join COUCH:TALK channel here https://t.me/couchcms_chat
Ryazania — a framework to boost productivity with Add-ons viewtopic.php?f=2&t=13475
Support my efforts to help the community https://boosty.to/trendo/donate
I've tried with:

Code: Select all
            <cms:if k_count-1 % 4 eq 0>


but I got:
ERROR! LOGIC_OP: Invalid char "%" (line: 32 char: 1206)

What is the module operator?
http://docs.couchcms.com/tags-reference/mod.html
I remember this had been discussed and solved earlier.
Join COUCH:TALK channel here https://t.me/couchcms_chat
Ryazania — a framework to boost productivity with Add-ons viewtopic.php?f=2&t=13475
Support my efforts to help the community https://boosty.to/trendo/donate
Ok, I've resolved with the following code:

Code: Select all
            <cms:php>
               $calc= "return <cms:show k_count/> % 4;";
               if ($calc == 1) {
                  echo '<div class="row mb-xl">';
               }
            </cms:php>
6 posts Page 1 of 1