My scenario is that I have a page where I would like to control its children in groups of, say, 6, until it runs out of children (the last group would have the remainder).
So for example, if i have 14 children of my page i'd like to be able to product something that looks like this:
<div id="group1"> <img src="image1.jpg"> <img src="image2.jpg"> <img src="image3.jpg"> <img src="image4.jpg"> <img src="image5.jpg"> <img src="image6.jpg"> </div> <div id="group2"> <img src="image7.jpg"> <img src="image8.jpg"> <img src="image9.jpg"> <img src="image10.jpg"> <img src="image11.jpg"> <img src="image12.jpg"> </div> <div id="group3"> <img src="image13.jpg"> <img src="image14.jpg"> </div>
This would be supposing that each child had an attached image that happened to have a filename numbered according to its position, but that's unimportant because I'd just get attributes of each child using controls like $Link, $Title, etc. The important part is that the children are grouped by sixes.
The example HTML output above might be produced by something like:
<% control ChildrenBySixes %> <img src="$Link"> <% end_control %>
I've been thinking about this for some time and I Just can't seem to figure out anything that would actually work. I would assume that everything would need to be handled by the controller, but as far as I'm aware the controller doesn't let you spit out any HTML, which needs to appear periodically (the "</div><div id="group$nextGroupNum>" or similar, and of course you can't iterate in a template, which I need to do in order to cover all the children.
My second problem is that I can't quite seem to figure out how to construct a request for a DataObject of the children of the parent page, which I assume would probably be part of the solution.
Thanks for any help you might be able to offer!