Navigation in show item page

Hi all,
i’m new to Omeka S and php coding and i’m trying to improve an Omeka S backend for a local archive.
An archivist asked me if it’s possible to insert navigation buttons in the show item page.
We’d like to insert a previous and next button to navigate between the items of the same father item-set.
The ordering of the items is an integer resource value (we used rdf:value).

The idea was something like this:

<div class="meta-group">
	<h4><?php echo 'Navigation; ?></h4>
	<div class="value item-sets">
		<?php
			
			//get the number of the item
			$number  = item->value(rdf:value); 
			
			//get the father item-set (the only one with the "Collection" class)
			$itemsets = $item->itemSets();
			foreach ($itemsets as $itemset){
				if ($itemset->displayResourceClassLabel() == 'Collection') $fatherset = $itemset;
			}
			
			//get all the items contained in $fatherset in the $items variable
			?
			?
			?
			
			//select the next and the prev
			foreach ($items as $obj) {
				if ($obj->value(rdf:value) == $number + 1) $next = $obj;
				if ($obj->value(rdf:value) == $number - 1) $prev = $obj;
			}
			
			//echo the links
			echo $prev->link('Previous');
			echo $next->link('Next');
		?>
	</div>
</div>

Now i don’t know how to obtain the vector/array of items contained in the $fatherset (??? lines).

Is there a way “in the API’s way” like with the search query call? i don’t think i need to use an API request in a php web page generating though…right?

Thank you all very muchh,

Andrea.

Dear Andrea,

I am also quite new to PHP coding and I was looking for the same functionality, but I found this module https://github.com/Daniel-KM/Omeka-S-module-Next
had the code included (specifically here: https://github.com/Daniel-KM/Omeka-S-module-Next#previousnext-resources)
I pasted the code in my show item page, and did some quick css formatting.
I used it on one of our collection sites here: IsiXhosa Intellectual Traditions (IsiXIT) Digital Archive · Imvo Zabantsundu 1884-12-15 · Ibali

I think it is also possible to configure in the site settings to indicate which field to use to sort the items.

Maybe it can assist,
Sanjin

1 Like

Dear Sanjin,
thank you very much for the pinpoint on the module, i donnow why i didn’t find it when i searched for modules!
when it comes with the Internal Id order it works perfectly, exactly as i wanted!

i’ll try to change something into the module to obtain my aim, it’s a good start although i think i’ll need some more help on this topic.

thank you again,
Andrea

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