MODX Community

String Output Modifiers: What is modulus (mod)?

I’m unfamiliar with this term. What does this modifier do?

Here’s an example of it in usage within a chunk tpl for a getImageList:

[[+idx:mod=4:isequalto=0:then=</div><div>]]

What is this supposed to be doing?

Thanks

The modulo operation returns the remainder of a division of 2 integers.
So in this case, if [[+idx]] is 0, 4, 8, 12, … the remainder is 0 and </div><div> gets written (probably to create a layout with 4 columns).

2 Likes