Created
January 20, 2016 14:06
-
-
Save ucay/d5ecd9aca05c1ca47c3a to your computer and use it in GitHub Desktop.
CouchCMS Pages - Grouping every x post
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Grouping every 4 posts --> | |
<cms:set fields='4' /> | |
<!-- check index if the first in a row [ (index-1) modulus 4 == 0 ] --> | |
<cms:set temp="<cms:sub k_count '1' />" /> | |
<cms:set first_in_row="<cms:mod temp fields />" /> | |
<cms:if first_in_row == '0' > | |
<div class="row"> | |
</cms:if> | |
<!-- show content --> | |
<div class="col-md-3">contents goes here</div> | |
<!-- check index if the latest in a row, or the latest page --> | |
<cms:set last_in_row="<cms:mod k_count fields />" /> | |
<cms:if last_in_row == '0' || k_count == k_total_records_on_page > | |
</div> | |
</cms:if> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment