I'm trying to group some items based on their groupID. So far, I managed to do with:
static $default_sort = 'groupID DESC';
Now I'm trying to read data into my template using the control-loop which works fine, showing all data sorted as defined. But now what I want, is the groupID to be displayed only if it differs from the previous value. Is there some way of saying:
// Pseudo code
if thisGroupID equals previousGroupID then
Within the template control loop you have access to the methods of the current item being iterated over in the loop and the items parent ($Top.) methods. Normally I would create a Group DataObject and Item DataObject. Then assign the appropriate relationships ($has_many, $has_one, etc.). Once that is done you can loop through each Group and within the Group loop through it's Items. Beyond that I believe you'll have to write your own methods in your PHP Class to do the logic.