Loop Files on show.php


I'm trying loop all files of a item on show.php (from theme), using the function loop('files'), like this:

foreach(loop('files',$items) as $file)

but when i do this i receive this error:

"Omeka has encountered an error

An array of records is not available for the loop."

i'm doing something wrong?

i tryied use the set_record_loop, but didn't work too

i would like to use the loop('files') to resolve this problem:


but in 2.x version


It might just be that some piece is missing. In how the functions fit together. Something like

set_loop_records('files', files_for_item());
foreach(loop('files') as $file)

should do the trick

Thanks the answer patrick,

but new erros came:

"Catchable fatal error: Argument 2 passed to set_loop_records() must be an array, string given, ... "

the set_loop_records need a array,
exists another function that return all files in a array?

i did!

i need to do this:

set_loop_records('files', get_current_record('item')->Files);

foreach(loop('files') as $file)

and then worked! \o/

now, i'm having problems with all_element_texts, but i'll start another thread.

Thank's again for help!

ps.: Need I close this thread?

Sorry for leading you astray with the wrong function! I'll close this!