Skip to content

Instantly share code, notes, and snippets.

@erochest
Created June 26, 2015 14:09
Show Gist options
  • Select an option

  • Save erochest/1bb6304fe536da611bfa to your computer and use it in GitHub Desktop.

Select an option

Save erochest/1bb6304fe536da611bfa to your computer and use it in GitHub Desktop.
How to show the links to the Neatline item from the Omeka item's page
<?php
$db = get_db();
$id = get_current_record('item')->id;
$sql = "SELECT id, title, exhibit_id FROM {$db->prefix}neatline_records " .
"WHERE {$db->prefix}neatline_records.item_id=?;";
$result = $db->query($sql, array($id));
$rows = $result->fetchAll();
$exhibits = $db->getTable("NeatlineExhibit");
if (! empty($rows)) {
?>
<div id="neatline-links" class="element">
<h3><?php echo __('Neatline Items'); ?></h3>
<ul>
<?php
foreach ($rows as $row) {
$exhibit = $exhibits->find($row['exhibit_id']);
$url = nl_getExhibitUrl($exhibit, "fullscreen");
if (empty($row['title'])) {
$title = metadata('item', array('Dublin Core', 'Title'));
} else {
$title = $row['title'];
}
echo "<li><a href='{$url}#records/{$row['id']}'>{$title}</a> ";
echo "in {$exhibit->title}</li>";
}
?>
</ul>
</div>
<?php
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment