Problem in displaying list of files for an item

Posting this on behalf of our stuff. We want to have a list of all files (with the original filename) under the viewer in our show.php page (similar to this example: For some reason none of the available functions seem to work. Obviously, we miss something.

The closest we have come is with get_current_record (following, but the filenames come one next the other and not as a list. The loop example described in don’t seem to work either. The display_files_for_item and the equivalent for version 2 files_markup is not what we want, because we want the files to be listed in textual format and not as images (thumbs, etc).

Any help would be appreciated.


What version of Omeka are you using?

Apologies. Forgot to mention that we are using Omeka 2.1.4 with the Berlin theme installed.

I think what you want is just a small variation on that post, with some html:

<?php foreach ($item->Files as $file): ?>
<li><?php echo metadata($file, 'original_filename'); ?>

<?php endforeach; ?>

Thanks Patrick. It worked indeed, as far as the listing concerns. Now we are checking how to link with the file. As far as we see it the metadata function can not connect to the file, are we right about it?


You are indeed right, metadata doesn't do anything with linking. It's just about displaying data about a record.

You have a couple options for what the links could do. Every file has its own show page, which displays the file and additional metadata about it. Alternatively, you can link directly to the file itself. The following shows both those options. First <li> goes to the show page, second goes directly to the file.

<?php foreach ($item->Files as $file): ?>
<li><?php echo link_to_file_show(array(), null, $file); ?></li>
<li><a href='<?php echo $file->getWebPath(); ?>'><?php echo metadata($file, 'Original Filename');?></a></li>
<?php endforeach; ?>

Many thanks Patrick. Just tested this on localhost and it looks as we want it. Both options are ok, so we need to decide taking into consideration some content parameters.

Again many thanks.