Paging through items in collection

My sitemap looks like this
Home > Collections > SpecificCollection > ItemInSpecificCollection

I want the < previous item and the next item > to only show items that are in the same collection as the current item.
How would I do that?

And what if I searched an item by tag and want to only display < previous & next > items that have the same tag as this one?

The links are made with the following code:

  • <?php echo link_to_previous_item_show(); ?>
  • <?php echo link_to_next_item_show(); ?>

Or is there a better way to show details of items within a specific collection or with specific search criteria?

Thanks in advance!

Hi,
I’m just looking for the same question :slight_smile: Maybe it is described somewhere else?
Borys

This is not described anywhere, because it requires a specific code. I just published a plugin to order item by metadata (https://github.com/Daniel-KM/Omeka-plugin-Helpers). The plugin ItemOrder may be useful too.

1 Like

Hey! Thanks for the respons!

For some reason if I activate both the itemOrder-plugin and your Helpers-plugin, I get an error trying to browse the items in a collection.

Hi Daniel,
Thank you for your answer :slight_smile:
I checked your plugin and it basically worked well, but I also noticed problem (error) when trying to open last added element in any collection. Then I found a message from annelien, so I switched off the ItemOrder plugin and it helped!
Thanks a lot!
Borys

I fixed the plugin Helpers, this is a plugin where I put various stuff and I forgot a file. You can use the two plugins together now.

Hi Daniel,

Plugins work together now. So I’m guessing you just have to install it without changing anything to the code?

In my omeka-test-site I have 2 collections. When in my first collection I tested clicking ‘next’ a bunch of times, it stayed perfectly in the current collection.
Then I tried the same thing with the ‘previous’-link. For some reason did not do the job. Then I tried the same things in de second collection, here the next & previous worked like before, jumping to other collections. When I went back to my first collection, again the next-button worked fine, the previous not.

I have no idea what is going on, because everything is called the same way, so I have nu clue why they would react differently to the plugin.

Am I doing anything wrong? Should I change something in my code?

Thanks! :slight_smile:

I fixed the plugin again. Now, it works better when the plugin itemOrder is enabled, but not ready. So use Helpers alone or with ItemOrder, according to your needs.

Still not working for me, I’m so sorry, I think I’m doing something wrong…
Thanks for all your efforts, Daniel. Very much appreciated

Hard to check without a real example, it works in all my cases.

This is the latest version that works for you?

Yes, the master https://github.com/Daniel-KM/Omeka-plugin-Helpers/archive/master.zip.

Okay, I double checked everything. Maybe it does work, just not in the way I was expecting it to and it got me confused in a way?

So what I guess it is doing now:

  • When you click next, you go the next item in the collection (defined by item order plugin)
  • When it is the last item of that collection, it goes to the first item of the next collection
  • When you click previous, you go the previous item in the collection (defined by item order plugin)
  • When it is the first item of that collection it goes to the first item of the previous collection.

What I expected it to is about the same, but I want the last item of a collection to

  • OR not display a ‘next button’, because te collection is finished
  • OR go back to the first item of the same collection
  • same methods for ‘previous’

So like this, there will be no possibility to just jump from one collection to another without even noticing.
If this is not what your plugin does, then I am sorry for the misunderstanding.

Thanks for sharing your work! :slight_smile:

Hi, here is my report:
On my site www.3d-muzeum.pl with last version of Helpers, everything works as you want: from the last item it goes to the first of the same collection, and previous from the first is the last.
Maybe because I have ItemOrder switched off…
Thank you David for this plugin!

When item order plugin is not enabled, the order is defined according to the element set in the config, alphabetically (generally title or date).

A plugin can do a lot, but the more you want a specific behavior, the more you have to go to the code.

Here, you can check the collection before printing the buttons. You can use the helpers $this->getPreviousItem() and $this->getNextItem() and $this->getItemInCollection() in your theme too. See the code, it is documented.

This topic was automatically closed 250 days after the last reply. New replies are no longer allowed.