How do I create a custom page in Omeka?

I have a fairly simple question about Omeka, and I hope there’s a fairly simple answer (or that someone can point me to the right place in the documentation or discussion forum.) If an item has a few media files associated with it, how would I go about creating a template for a dynamically-generated page that would display one of those media files and not all of them at once? Here’s the context for the question: with BrailleSC, we’re creating an Omeka archive of oral histories. Each oral history item will be presented as a transcription (in HTML), a video file (MP4), and an audio file (MP3). As I understand it, the default page for an Omeka item automatically displays all of the files associated with that particular item, and in the case of a 30-minute video what that means is the user must wait for a pretty large video file to load, even if all they’re interested in is the transcription or the mp3.

Now, we could use some kind of Flash-based player that wouldn’t load the video on the page but would stream it when the user specifically triggers the video; unfortunately, however, Flash is not compatible with the screen reader shoftware used by many of our intended audience.

What’d we like to have is a page that automatically displays the transcription (and maybe a screenshot from the video) but just provides links to the pages that contain the video and the audio. If I understand the backend correctly, such pages would need to be passed the “id” of the Omeka item so that they could then grab the appropriate video or audio file and embed it on the page. Is that correct? Could anyone give me a nudge in the right direction so that I could hack something together?

Thanks in advance for any and all advice!

Print Friendly, PDF & Email

3 thoughts on “How do I create a custom page in Omeka?

  1. Thanks, Andrea!

    Maybe I could use the display_items_for_file helper function in a video-dedicated page, and then use a conditional statement to display the appropriate file based on what kind of file it is (?).

  2. Okay, with some advice from Cory I found a solution (or at least the beginning of a solution).

    We’re using a modified version of the Autumn theme for Omeka, and the original show.php file looks like this on lines 19 through 23:

    <!– The following returns all of the files associated with an item. –>
    <div id="itemfiles" class="element">
     <h3>Files</h3>
      <div class="element-text"><?php echo display_files_for_item(); ?></div>
    </div>

    But I don’t want each item page to automatically display all of the files associated with the item. Doing so would be fine if each item had a few images associated with it, and if show.php displayed those images (or thumbnails of those images). It’s not so fine, however, when there is a large video file (or a number of large video files) associated with each item.

    What I want instead is a link from the default page for each item to the large file. To achieve this, I added the following to show.php:

    <!– If the item is an oral history, the following returns the duration of the interview, a link to the video file, and a link to the audio file –>
    <div id="itemfiles" class="element">
     <p class="element-text">
      <?php if (item_has_type(‘Oral History’) ): ?>
      <h3 style="margin-bottom: 1em;">Video and Audio</h3>
       <div style="margin-left: 1em; margin-bottom: 1em;">
        <p><strong>Duration: </strong><?php echo item(‘Item Type Metadata’, ‘Duration’); ?></p>
       </div>
      <p class="element-text">
      <?php if(!item_has_files()):?>
       <p>There are no files for this item. <?php echo link_to_item(‘Add some’, array(), ‘edit’); ?>.</p>
      <?php else: ?>
       <ul>
       <?php while(loop_files_for_item()): ?>
        <?php if(item_file(‘Dublin Core’,’Format’) == "medium quality mp4"):?>
         <li style="margin-left: 1em; margin-bottom: 1em;">
          <strong>Video:</strong> <a href="<?php echo item_file(‘permalink’); ?>">Click here to watch.</a>
         </li>
        <?php elseif(item_file(‘Dublin Core’,’Format’) == "mp3"):?>
         <li style="margin-left: 1em; margin-bottom: 1em;">
          <strong>Audio:</strong> <a href="<?php echo item_file(‘permalink’); ?>">Click here to listen.</a>
         </li>
        <?php endif;?>
       <?php endwhile; ?>
       </ul>
      <?php endif;?>
      </p>
      <?php endif; ?>
     </p>
    </div>

    First, this bit of code checks to see if an item is an ‘Oral History.’
      <?php if (item_has_type(‘Oral History’) ): ?>

    If it is, the duration is displayed.
      <?php echo item(‘Item Type Metadata’, ‘Duration’); ?>

    Next, all the files are checked.
      <?php while(loop_files_for_item()): ?>

    If a file has the format ‘medium quality mp4’ — we’re thinking of having 3 different qualities of mp4s so users can choose, depending on the speed of their Internet connection — then a link to that file is created, using the words "Click here to watch."
       <?php if(item_file(‘Dublin Core’,’Format’) == "medium quality mp4"):?>
        <li style="margin-left: 1em; margin-bottom: 1em;">
         <strong>Video:</strong> <a href="<?php echo item_file(‘permalink’); ?>">Click here to watch.</a>
        </li>

    If a file has the format ‘mp3’ then a link to that file is created, using the words "Click here to listen."
      <?php elseif(item_file(‘Dublin Core’,’Format’) == "mp3"):?>
        <li style="margin-left: 1em; margin-bottom: 1em;">
         <strong>Audio:</strong> <a href="<?php echo item_file(‘permalink’); ?>">Click here to listen.</a>
        </li>

    I’ve taken screenshots to illustrate the results (click on any image to embiggen).

    Here’s the item page; note that there are 2 links displayed under “Duration”:

    BrailleSC item page

    Here’s the file page for the video:

    BrailleSC file page, video

    And here’s the file page for the audio:

    BrailleSC file page, audio

Leave a Reply to george Cancel reply

Your email address will not be published. Required fields are marked *