Can the IF extra cn be use with odd

Hi,
I am writing a chunk whoch will display pictures with text within a div.

It will have 2 colomn and “many” rows.
Before the first picture, I need to add <div class="row"> and after the second picture, I need to add </div>, in order to build the row with two cell.

My idea, was to use the extra if with idx. I looked at the doc but it look like I can not check if the number is an odd or not (I hope I did not miss something :slight_smile: ).

Do you have a suggetsion?

Here is how I strated:
I add here idx=1, to make sure, the incrementation start with 1

[[getResources? 
					&parents=`[[*id]]`
					&idx=`1`
					&includeContent=`1`
					&includeTVs=`1`
					&tplWrapper=`@INLINE <div>[[+output]]</div>` 
					&tpl=`evenementsTpl`
					&sortby=`{"menuindex":"ASC"}`
					&limit=`0`
					&showUnpublished=`0`
					&showHidden=`1`
				]]

in my evenementsTpl, I added this

[[If?
	&subject=`[[+idx]]`
	&operator=`=`
	&operand=`5`
	&then=``
	&else=``
]]

My idea, is “if odd use then, if pair use else”

Thanks

Instead of your IF call - I’d use the modulus output modifier here:

[[+idx:mod:is=`1`:then=`odd`:else=`even`]]

The getResources snippet has a &tplOdd parameter, which might do what you want.

1 Like

Good shout Bob - forgot about that!

Thanks @dejaya and @bobray for your replies.I am going to look for botth.

I saw that but I need to have additonal chunck and I prefer to limit.
I sucessed with output modifier.

Thanks