Functions/loop files for item

Description

loop_files_for_item() provides a loop through the files, allowing you to template things like lists of files associated with an item.

Usage

<?php while(loop_files_for_item()): ?>
<!-- Template the file info -->
<?php endwhile; ?>

Arguments

  • $item (object) or null (default). If null, the current item is used.

Return Value

Mixed. The current file within the loop, or null if at the end of the loop

Examples

Creating a list of file names for an item

This example begins by creating an unordered list, then populating its list items by using a while loop to step through the individual files.

<ul>
    <?php while(loop_files_for_item()): 
        $file = get_current_file();?>
        <li><?php echo $file->original_filename; ?></li>
    <?php endwhile; ?>
</ul>