Custom records loop

Hi, I'm having a lot of trouble with getting a custom records loop to work on the browse.php page. I've tried all the things from these instructions, but no luck.

Could you post up the code that you currently have, and which browse.php file (e.g., items, collections, etc)?

Sure, here it is:

set_items_for_loop(get_items(array('featured' => true),50));
<?php if(has_items_for_loop()): ?>

<!-- Loop for items -->
<?php while(loop_items()): ?>
<div class="item">
<h2><?php echo link_to_item(); ?></h2>
<p><?php echo item('Dublin Core', 'Creator'); ?></p>
<?php endwhile; ?>

<?php else: ?>

<!-- Message if there are no items -->
<p>No items</p>
<?php endif; ?>

ah, sorry. I should've looked more closely at the link.

That's for Omeka 1.x. Guessing that you are using Omeka 2.x, you'll want to refer to the Omeka 2 documentation

Thanks, I just worked that out. Are there any examples showing how to do a custom loop for omeka 2.x versions?

This updating guide will help show the changes from your code to the Omeka 2 code.

Ok, so I have translated some things to omeka 2.x. But I can't work out how to load a custom list of items into the loop.

set_loop_records('items', get_records('items',array('featured' => true ),20));

Ok, so the get_records function needs 'Item' as the type not 'items'. This seems to work:

$items = get_records('Item', array(), 25);
set_loop_records('items', $items)