There is a way to do this, but you have to forgo using the
display_files_for_item() helper and write out a custom loop of files.
We could probably make this an option in that helper in a future
release. In the meantime, here's one example of what you could do in
your items/show.php template:
<?php foreach($item->Files as $file): ?>
<a href="<?php echo file_download_uri($file); ?>"><?php echo
item_file('Dublin Core', 'Title', array(), $file); ?></a>
<?php endforeach; ?>
This gets the array of $item->Files, and loops through each. It uses
the file_download_uri() helper to get the path of the file to
download, and sets that as the value for the HREF attribute. It also
uses the item_file() helper to get metadata for a file, and adds that
as the text inside the <a> tag.
This, of course, would use the same markup for all files, regardless
of type, so it wouldn't show thumbnails or embed videos. If you need
to account for different ways to display different types of files,
that can be done too.
Hope this helps!
Jeremy
Actually, looking at this more, it would be better to use the
loop_files_for_item helper instead of using the $item->Files array
directly. The first example I gave you works fine, but this one uses a
bit less code, and doesn't require you to send all the options to the
item_file() helper:
<?php while(loop_files_for_item()): ?>
<a href="<?php echo file_download_uri($file); ?>"><?php echo
item_file('Dublin Core', 'Title'); ?></a>
<?php endwhile; ?>
The loop_files_for_item() helper is documented (http://omeka.org/codex/Theme_API/loop_files_for_item
), but the example doesn't use the item_file() helper to retrieve
metadata about a file. I'll be sure to update that when I get a chance.
On Sep 19, 2009, at 6:25 PM, Jeanne wrote:
> Thanks.. this looks like just what I was looking for.
> Is file_download_uri($file); documented someplace I didn't find?
That helper isn't documented; in fact, its not even listed on the
Theme API page. It will basically give you the web path for a given
file in your archive directory. We can add that to the list, though.
Best,
Jeremy