Apply grouping to custom views list template I have a custom views-view-list.tpl.php template that uses 

foreach ($view-&gt;style_plugin-&gt;rendered_fields as $delta =&gt; $item)


to manipulate the fields at this template level rather than using

foreach ($rows as $id =&gt; $row)


and relying on views-view-fields.tpl.php to render the HTML.

However, when using grouping in a view, the views-view-list.tpl.php is called once for each grouping, but the first method renders all items, rather than just the ones in the current grouping.  

How can I tell from views-view-list.tpl.php which items belong to the current grouping?
Turns out the $rows object has indices that don't go from 0, counting up by 1.  It keeps only indices of the items in the current group.  That makes this code work:

&lt;?php foreach ($view-&gt;style_plugin-&gt;rendered_fields as $delta =&gt; $item): ?&gt;
    &lt;?php if(isset($rows[$delta])) : ?&gt;
         ... print out whatever necessary ...
    &lt;?php endif; ?&gt;
&lt;?php endforeach; ?&gt;