Problems, need help? Have a tip or advice? Post it here.
3 posts Page 1 of 1
Hi!

Is that possible to show a certain number of repeatable items in a region?
I would like to do something like :

Code: Select all
  <cms:show_repeatable 'profile_sujets_possibles' limit="2">
              <li>
                <cms:show sujet_possible />
              </li>
   </cms:show_repeatable>


To show the first 2 rows in this repeatable region.

but it doesn't seem to be working. Any workaround?
Thanks!
Hi,

If we were to place a <cms:dump /> within the cms:show_repeatable block as follows -
Code: Select all
<cms:show_repeatable 'profile_sujets_possibles'>
    <cms:dump />
</cms:show_repeatable>
- we'll see a list of all the variables made available for use at this point. One of the variables would be 'k_count'. This begins with '1' for the first row and increases with each row.

We can use this variable to target just the first two rows as follows -
Code: Select all
<cms:show_repeatable 'profile_sujets_possibles'>
    <cms:if k_count lt '3'>
    <li>
        <cms:show sujet_possible />
    </li>
    </cms:if>
</cms:show_repeatable>

For more use-cases, please see https://www.couchcms.com/forum/viewtopi ... 652#p11652

Hope it helps.
Thanks KK! It worked.
It's amazing how fast and useful the support is on this forum.
I learned something.

Thanks again!
3 posts Page 1 of 1