Problems, need help? Have a tip or advice? Post it here.
3 posts Page 1 of 1
I'm working with repeatable regions that can have anywhere from 1 to over 35 fields...

Can I insert a "break" or any other element between repeatables when displaying the values?

Let's say I'm displaying 10 repeatable images and I'd like to create a break after every 2 images. Tried a couple chunks of code I've found here on the forum, have come close but no cigar:

1.
Code: Select all
<cms:show_repeatable 'images' >                
<cms:set num = "<cms:mod k_count '2'/>"/>
<cms:if num == '1'>
        <div class="hidden-xs hidden-sm row">
</cms:if>
          <div class="col-sm-6">
            <h3><cms:show image_text /></h3>
            <img src="<cms:show image />" />
          </div> <!-- end col -->
<cms:if num == '0' || k_count == k_total_records>
        </div> <!-- end row -->
</cms:if>
</cms:show_repeatable>


2. Or what about to display an html element every 5 images? Tried this but no go.
Code: Select all
<cms:show_repeatable 'images' >
<cms:if k_count == '5'>
          <a class="btn" href="#" role="button">Hi</a>
</cms:if>
          <div class="col-sm-6">
            <h3><cms:show image_text /></h3>
            <img src="<cms:show image />" />
          </div> <!-- end col -->
        </div> <!-- end row -->
</cms:show_repeatable>


Do you think anyone can maybe point me in the right direction?

Thanks a lot!
-Izzy
Hi Izzy,

Why was the code in #1 insufficient? Unless I am misunderstanding, it should produce the desired markup...

For #2 you can use the zebra tag: docs/tags-reference/zebra.html
Code: Select all
<cms:zebra '' '' '' '' '<a class="btn" href="#" role="button">Hi</a>'/>
You're right! First code snippet is actually working correctly... I had discovered a different mistake on my part which was preventing proper rendering.

OK, nice... will try out the zebra function.

Thanks again, cheesypoof!
3 posts Page 1 of 1