Linking to Exhibit from item page

I'm using the ExhibitBuilder to organize our items into exhibits. I'd like to present a link on each individual item page back to the exhibit page or pages that it's a part of. Is this currently possible?

Hi santheo,

There isn't a helper function in the core or the ExhibitBuilder plugin that does this, but I wrote this function a while back to return links to any exhibits that used an particular item:

function link_to_related_exhibits($item) {

	$db = get_db();

	$select = "
	SELECT e.* FROM {$db->prefix}exhibits e
	INNER JOIN {$db->prefix}sections s ON s.exhibit_id =
	INNER JOIN {$db->prefix}section_pages sp on sp.section_id =
	INNER JOIN {$db->prefix}items_section_pages isp ON isp.page_id =
	WHERE isp.item_id = ?";

	$exhibits = $db->getTable("Exhibit")->fetchObjects($select,array($item));

	if(!empty($exhibits)) {
		echo '<h3>Related Exhibits</h3>';
		echo '<ul>';
		foreach($exhibits as $exhibit) {
			echo '<li>'.link_to_exhibit($exhibit).'</li>';
		echo '</ul>';

You can add this function to your custom.php file in your public theme, then use the function in your items/show.php file like so:

`<?php echo link_to_related_exhibits(item('ID')); ?>

This is all assuming your using Omeka 0.10. If you're using 0.9, you would need to use:

<?php echo link_to_related_exhibits($item->id); ?>

This could be modified to link to the actual page in the exhibit where the item is used.

Hope this helps!

Thanks, Jeremy. It's close, but it's not quite working. Unfortunately, I'm not sure how to nail down exactly what the problem is, as my Apache error log is quite about it. Basically the page renders up to the point of the function call, then stops. I've commented out stuff to hone in on the offending code, and it appears to be the "->getTable("Exhibit")" command. If I take that out, the page renders, though still not properly -- it doesn't show any results. But at least it renders. When I put that phrase back it, it borks again.

Not sure what to do at this point other than appeal to you for more assistance. Any ideas?


I was able to turn error reporting on. This is the error:

Fatal error: Class 'Exhibit' not found in (...)/application/libraries/Omeka/Db/Table.php on line 365

What version of Omeka are you using? I just tried this with 0.10, with the ExhibitBuilder plugin activated, and it works for me. I didn't try it with 0.9, but I can do that and get back to you. And now that I think about it, if you are using 0.9, you can't use a custom.php file in your public theme...I forgot about that! You'd either have to make a new plugin with just that function, or put the function directly in your theme/items/show.php file.

We're using .10. I thought it might be something screwy on my local development version, but it's throwing the same error on our server as well. Any advice you have on where to look next would be greatly appreciated...

So, after talking to Kris about this, and testing this out with santheo, it looks like the solution is to add require_once "Exhibit.php"; as the first line inside the function I offered. We're not sure why you have to do this, though. In any case, we'll probably add this or a similar helper to a future version of the Exhibit Builder plugin.