How to display the item type value on items show.php

We're able to display the elements of the Item Type Metadata array on our show.php for individual item records, but we'd like to also display the value of item type field itself.

It seems like item type is a key for item_type_elements rather than an part of the array that can get displayed.

Is there a way around this?
(Omeka 2.0.4)


Bobb Menk

You mean, you want to print the name of the item type for the item? This should work:

<?php echo metadata('item', 'item_type_name'); ?>

Yes like that - works perfectly!


I'm back at this with a follow-on issue. On items/show.php I'm trying to display the item_type_elements if there is data in those fields and suppress them if they're empty. My code is below, and it didn't seem to do what I was hoping for, so I echoed the count value to see what was going on and it's always greater then zero.

Is there something else I can test against to get data if it exists, but nothing if it's empty?

<?php if(count(item_type_elements($item))>0)
                echo count(item_type_elements($item)). '(';
                foreach ( array_keys(item_type_elements($item)) as $key ){
                     echo ($value=metadata($item,array('Item Type Metadata',$key))) ? ''.$key.': '.$value.', ' : null;
                echo ')';


Bobb Menk