Once I analyzed my item show.php file and thought about what I actually want to accomplish:
I want to create a Download link (it can just be hotlink to the actual file).
I don't need to display the images/files (already doing that elsewhere on the page).
So, I'm thinking that I could display specific metadata for the file following this: https://omeka.org/codex/Display_Specific_Metadata_for_an_Item_File
Is that the direction I should be heading?
Omeka 2.2.2, Berlin (heavily modded) theme (for now)
You can get the URL to the original file with the metadata function, by passing
'uri' as the metadata you're trying to get.
You could also use item_image_gallery, which will output thumbnails and links for all the files for an item, but not "display" the files (so there will be no embeds shown).
Ooh, thanks John! I suspected there would be more than one approach. I had not considered the item_image_gallery, but that is a really interesting idea. Our scrapbook has 81 files attached to 1 item record, so that might be a nice way to do that.
Here is the very simple code:
<?php echo metadata('file','uri'); ?>
It totally works except it is not a clickable hotlink. I'm not as well versed in generic PHP as I should be (I know how to do this in Wordpress and Drupal but those are very specific). Suggestions? I'd actually love for every http:// in my records regardless of where they are to just be hotlinked by default, but I don't know if it is easier to just change this here for the download link or try to do it globally?
It's not really a PHP situation here but HTML. With the URL getting output you just have to wrap it in regular ol' HTML for a link:
<a href="<?php echo metadata('file', 'uri'); ?>">Download</a>
Thanks - yes I realized I didn't write the most clear post re: mixing HTML and PHP ;-)
I swear I tried that yesterday afternoon and it didn't work! Thanks much - that does indeed work beautifully.
So, here is what I did since I love it when other people share working code :-)
Wrapped everything in a div file for styling...
<div class="element-text">Right click to download files. File format: "><?php echo metadata('item', array('Dublin Core', 'Format')); ?> </div>
Ok, this worked, but now I have 1 collection that will not any attached files. I need to check for a file before it tries to display.
So, I think I need to check for the file - an if / then statement and maybe print?
Or use goto?