How do i count a control loop?
Basically, i want to print some extra code every 3 times it goes through a loop.
eg
<% control LatestExhibtion %>
*** If this third time echo <br />
<% end_control %>
This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
How do i count a control loop?
Basically, i want to print some extra code every 3 times it goes through a loop.
eg
<% control LatestExhibtion %>
*** If this third time echo <br />
<% end_control %>
cross post, see my answer on the other thread.
What other thread :)
You might want to have a look at this http://ssbits.com/manipulating-every-nth-item-in-a-control-loop/
SS 2.4 has <% if IsMultipleOf(3) %> which should help :)
or $Pos if you're looking to assign a count to each item