"Undefined function" errors after customizing show.php

I'm working on some customizations to a theme in a Neatline exhibit, and I'm looking for a way to present a list of values from a single metadata element, de-dupe the values, and hyperlink them to a search result page in Omeka.

Here's a link to the site in it's current (and very early) state: http://neatline.ohio5.org/sandbox.

I've installed the Search by Metadata plugin which works great for values in metadata fields on individual item records that appear in the bubble when a user clicks on the plotted points on the map, but I'm trying to present the full list of values (de-duped) from a specific metadata element. Imagine a simple list of clickable values from a single metadata element.

I'm following instructions for creating exhibit-specific Neatline themes here: http://neatline.org/2014/04/01/creating-themes-for-individual-neatline-exhibits/. Based on these, I understand I can modify the show.php file in this exhibit-specific directory to alter some of the layouts of the site. I've tried adding some php to the show.php file, but I keep running into "undefined function" php errors so I'm not sure how to make the custom show.php aware of these functions. Where are they defined?

After failing repeatedly to get the metadata from a specific element type (we have an element called "Participants" we're trying to get), I decided to see if I could get any php to work so I tried calling the get_tags function described here: http://omeka.org/codex/Functions/get_tags, but this resulted in the following:

"Fatal Error : Call to undefined function get_tags() ...."

Here's an excerpt from my show.php file which resides at ../[omeka-theme]/neatline/exhibits/themes/[exhibit-slug]

<!-- Narrative -->
<div id="neatline-narrative" class="narrative">


<!-- Credits. -->
<!--<span>">← View all</span> • -->
<span>Home</span> •
<span>About</span> •
<span>Contributors</span> •


<!-- Content. -->
<h1 class="exhibit-title"><?php echo nl_getExhibitField('title'); ?></h1>
<?php echo nl_getExhibitField('narrative'); ?>

<!-- This is an experiment. Adding in collapsible navigation for tags -->
<div class="accordion" id="accordion2">
<div class="accordion-group">

<div class="accordion-item">
<div class="accordion-heading-panel">
<h3>Cast of Characters</h3>
</div> <!-- /end .accordion-heading" -->
<div id="collapseOne" class="accordion-body collapse">
<div class="accordion-inner-panel">

<?php $tags = get_tags(array('sort' => 'alpha'), 20);
echo tag_cloud($tags, 'items/browse'); ?>

</div> <!-- /end .accordion-inner -->
</div> <!-- /end #collapseOne -->
</div> <!-- /end .accordion-item -->

I'm not a PHP coder, but I know enough to be dangerous, and I suspect that's part of my problem...

Any guidance would be greatly appreciated.

If you're using a halfway-recent version of Omeka, that function just doesn't exist.

The Omeka 2 and up equivalent is the get_records function. I've updated that function page on the codex to note that it's out of date, but in general, current developer documentation for Omeka is on http://omeka.readthedocs.org .

Thanks, John. I'm using Omeka 2.2.2. so I'll stick to the current documentation you linked to.

I tried messing a bit with the get_records function, but what I'm really hoping to do is not get a list of records but a list of the values from one particular metadata element (in my case, the element is called 'Participants' and has the element id 30). With that list, I'd like to present each as a hyperlink that links to a search results page (essentially, I'd like to make each link an advanced search - example: Paricipants = Nero) which would lead to like this:



I try to display the tags added to an item on a simple page, but beyond a "true" with metadata($item, 'has tags') and an "Omeka_View_Exception" when trying to display them with tag_string('item'), I have actually no idea how to retrieve the tags based on get_records() (documentation seems to be close to zero). Is there a way to do this on simple pages in case you have a list of n-items having the tag "a", but who are and will be tagged with several other tags one wants to display, link etc.?

Any helpful suggestion is very much appreciated!


First, what versions of Omeka and Simple Pages are you running? In current versions, PHP in simple pages is disallowed for security reasons.

The tag_string function should get what you need in general, but again not if you have a current Simple Pages version. For current versions, you'd want to look into making a shortcode to do what you want.

I am still on Omeka 2.3 (not 2.3.1) and SimplePages 3.0.5 (will upgrade to 3.0.6 soon). In the SimplePage itself, I just have [items num=0 sort="Dublin Core,Title" tags="xyz" order=a] The output is formatted based on the single.php with a customized form of what is usually found in the show.php. Now, would you suggest to use a shortcode in the single.php to fetch all tags associated with each item, or can I use the tag_string function directly in the single.php? As mentioned above I tried to get some results with the tag_string function, resulting in the error "A current item variable has not been set to this view." Is there a code snippet that shows how this function is supposed to be used, or which arguments can be passed into it?

Not sure, whether these information shed more light on the issue...

Since you are making changes at the level of single.php, you can use PHP directly there. No reason to back out to shortcodes there.

The item being displayed is passed in to single.php in the $item variable, so echo tag_string($item) should show the tags there.

Oh right, thank you! I had tag_string('item'), and not tag_string($item) - my fault.

Thank you!