Rather than using the following in my item pages, I would like to use the 'file_markup' function. Regretfully not fully documented at:
Anyone have examples of using 'file_markup' function?
Thanks for pointing that out.
I'm not quite sure what you mean by "the following," or exactly what you were looking for in the documentation, but I added some much-needed definitions for the
$props array argument and some extremely simple examples.
No changes to item pages with just one file attached. For the one item page with two files attached, neither meta-data, nor files (digital assets) appear.
Am I missing something?
Does this function work in OMEKA pre 2.0?
Also, once I get this to work, how can I set the location on the page for each file?
No, all that documentation is for Omeka 2.0 only.
To display all the files for an item in Omeka 1.x, you already have the right function:
display_files_for_item. To display specific files, you'd use
display_file (for a single file), or
display_files (for an array). The arguments are pretty much the same for all of these.
OK, once I get to work, how do I set the location on the page for each file?
I imagine the easiest thing to do would be to have multiple calls to
display_file, each at whatever point in the page you want that file to appear. If you have the array of files
$files = $item->Files, then you can do something like
display_file($files, ...) to display the first,
display_file($files, ...) to display the second, etc.
Since I assume you'll be using the same show view for items with different numbers of files, you'll probably have to have some conditionals that check against
count($files) or if a particular index exists (
I'm not quite sure what you're trying to do, so its hard to be much more specific.
Thanks, John. Now I am completely confused. Are you referring to pre-Omeka 2 or Omeka 2.0?
What I want to do is have multiple files (images, audio files, etc.) displayed on one item page; which I am able to do, BUT because they get spit out via an array they appear one after another, so would like to control location of each file on the item page.
In show.php are you suggesting something to the effect of:
<?php echo display_file($files); ?>
<?php echo item('Dublin Core', 'Title'); ?>
<?php echo item('Dublin Core', 'Format'); ?>
<?php echo item('Dublin Core', 'Date'); ?>
<?php echo display_file($files); ?>
<?php echo item('Dublin Core', 'Description'); ?>
That's basically what I'm suggesting, yes.
My last posting, and anything mentioning
display_file, is referring to Omeka 1.x.
Did not work in 1.0.
All files still grouped together.
How to do in 2.0?
Can you share your whole show page? (Also, are you running both 1.x and 2.0 installations? It'd be easier for this to pick one and stick with it.)
The same strategy should work for both 1.x and 2.0, its just that the function names are different. All you should need to do is remove the existing call which is displaying all of the files, and replace it with your own function calls that display the files at the places of your choosing.
This is what I have for 1.x:
Still working on 2.
I see a couple problems at a glance:
- If you're going to use the
display_file calls I suggested, you need to actually get the files to work with into the
$files variable. I mentioned that in the same post, but I'll repeat it here: you need a line like
$files = $item->Files. That line should appear at or near the top of the show.php file, before any of your
- You still have the
display_files_for_item call in your show.php. That call is what prints all the files, one immediately after the other. You'll have to remove that or comment it out.
Alright getting closer:
Which allows me to place files in specific places.
However, all meta-data is cut off after format for all other items:
Think meta-data is cut off because there is no file to echo for item with just one file.
You need to wrap those display_file calls in a check to actually make sure there are that many files to display.
And so on for as many
display_file calls as you're using.
That seems to do it:
however, breaks page loses its integrity if I do not have more than one subject defined.
Is it because I do not have subjects enclosed in div? How to correct:
$subjects = item('Dublin Core', 'Subject', 'all');
if (count($subjects) > 1):
<div id="item-tags" class="element">
<?php foreach ($subjects as $subject): ?>
<?php echo $subject; ?>
<?php endforeach; ?>
<?php endif; ?>
Also, how to translate to 2.0?
Not sure why the fonts changed on my subjects:
Have any idea: