Different Display Item Pages for Different Item Types


I am working on a theatre performance site with diverse range of items, from whole productions to audio interviews with cast. I would like to set it up so that I can showcase each of those items differently. So for example, if it is an audio file with a transcript - the transcript text get displayed as the core part of the image, but if it is about a production then I would perhaps want to have the photos that link to that production displayed, etc.

How can i configure the theme within my Omeka-S, to call on different CSS code (eg transcript vs production) depending on the item type? I am working on adapting the Speak-Out theme which is tailored towards transcripts, but now want to figure out how I can generate different item views depending on different resource templates? I imagine it will go with editing the item/show.phtml and writing conditional loops based on what item type it is, and then pairing it with the relevant css property i want to use.

I realize this might have something to do with a similar question for Omeka Classic - https://forum.omeka.org/t/different-viewers-for-different-item-types/7866 but it is not just about the viewers but the whole layout of the page.

Any guidance will be appreciated.

Yeah, your assumption about how to do this is about right: you can look up what resource template an item is using within the view with $item->resourceTemplate() ($item->resourceTemplate()->label() gives you the name of the template). You could also do something similar with the resource class.

If you’re just trying to use different CSS and not different markup, that’s easy: you can check on the template/resource-class and put a class on the body tag (or really, any tag that encompasses everything you want to change) and then just target those classes with your differing CSS. You’ll probably see that the item show view file already has an example of modifying the body class:

$this->htmlElement('body')->appendAttribute('class', 'item resource show');
1 Like

Thank you! I will try it out and experiment. I need to set up a local Omeka-S installation so I can mess it up without breaking anything on the actual server. Many thanks for your guidance.

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