This seems like a dumb question, even to me, but I have no idea how to loop items outside the designated views where $items is already defined and cannot find any useful and clear documentation of how custom looping works.
For example, what if I need to loop through items that fit a certain criteria (e.g. in a specific collection) from within, say, the homepage, or the items/tags template, or the footer?
Shouldn't something like the following always work?
$myItems=get_records('item', array('hasImage'=>true, 'featured'=>true),10);
set_loop_records('items', $myItems);
foreach(loop('items') as $item)
// do something;
endforeach;
I can't seem to find a method that works everywhere. What am I missing?