Hi there. I’m putting together a site using Omeka Classic, Berlin Theme. I know a bare minimum of PHP and have been muddling through code changes, but I’ve run into something I can’t solve with my current skill level. Is it possible to change how Item pages display files based on item type? I’d like to use Universal Viewer for still images and text, and Omeka’s default player for audio and video. That would also mean hiding the “File” field when the Universal Viewer is active so that files aren’t displaying twice. Any help, hints, and suggestions are most welcome. Thank you!
Using the metadata function you can get the name of the item type of the current item:
$itemType = metadata('item', 'item_type_name');
Then you can use just regular
if constructs in the items/show.php file to change how things display based on the item type.
Thank you, that was just what I needed to get started! Now I’m just hung up on the code to conditionally display or hide the “Files” field. I’m familiar with the display property in CSS, but not sure how to translate that to PHP.
Instead of using CSS you can just not render the stuff you don’t want at all… Find the part of the view that shows the files and wrap it in an appropriate
I’m trying to do basically the same thing… display Universal Viewer for most item types, but not items with embedded video (Moving Images item type).
This if statement is ignored; the item’s thumbnail image file displays in Universal Viewer, which is what I want to hide.
My php skills are usually enough to get by, but I’m missing something here!
<?php if (metadata('item', 'Item Type Name') != 'Moving Image'): ?>
<?php endif; ?>
<?php get_specific_plugin_hook_output('UniversalViewer', 'public_items_show', array('record' => $item, 'view' => $this,)); ?>
I appreciate any help to solve the little mystery!
jflatnes or danielkm? Thanks!
This topic was automatically closed after 250 days. New replies are no longer allowed.