I am updating a theme from 1.5 to 2.1 and have replaced all the functions which have new names in this version. However, now I am getting an error message: Omeka_View_Exception
A current item variable has not been set to this view.
Here is the code that is throwing the error:
foreach ($collectionIDs as $collectionID) {
$collection = get_record_by_id('collection',$collectionID);
$collection_link = link_to_collection($collectionTitle, array(), 'show', $collection);
$collection_items = get_records('Item',array('sort_field' => 'Dublin Core,Audience','sort_dir' => 'a','collection' => $collection['id']),9000);
$num_of_collection_items = count($collection_items);
set_loop_records('items',$collection_items);
$collection_item_list = array();
while (loop('items')) {
get_current_record('item');
array_push($collection_item_list, array('thumb'=>item_square_thumbnail(array('alt'=>item('Dublin Core', 'Title'))),
'link'=>item_uri(), 'name'=>item('Dublin Core', 'Title')));
}
echo '<h1 style="display: inline;">' .$collection_link. '</h1>';
echo '<hr style="visibility: hidden; margin-top: 2px; margin-bottom: 4px;" />';
echo '<ul id="collection'.$div_counter.'" class="slider">';
for ($i=0; $i < $num_of_collection_items; $i++) {
echo '
<li>';
echo '<a href="'.$collection_item_list[$i]['link'].'" rel="tooltip" title="'.$collection_item_list[$i]['name'].'">'.$collection_item_list[$i]['thumb'].'</a>';
echo '</li>
';
}
echo '';
echo '<hr style="visibility: hidden; margin-top: 3px; margin-bottom: 3px;" />';
$div_counter++;
}
Specifically "get_current_record('item');" is throwing the error. Can someone explain how to properly loop through items using loop('items')? I think that is my problem. Thank you very much!