I am trying to wrap a div () around my channel entries output every 3rd item. So
entry1 entry2 entry3 entry4 entry5 entry52 Answers
you can use {switch} or {if} condition with % Operator "Remainder of one number divided by another" like this:
1- {switch}
variable :
{switch="<div>||"}
....Your code....
{switch="||</div>"}
2- {if}
with %
:
{if count=="1" || count%4==0}<div>{/if}
....Your code....
{if count%3==0}</div>{/if}
Be aware that the operator functionality was added as of EE v2.7.1. If you choose to use the switch method mentioned here, you actually need to handle it a bit differently to protect your loop from instances in which the number of entries you are loading does not divide evenly by the number of columns you are loading. The most effective way to do with is to add additional switch logic to close the row. You can see this in detail in another EESE post with my answer here:
Adding wrapper markup at intervals within loops (entries, matrix, playa, etc)