{exp:assets:files}

You can use the {exp:assets:files} tag pair to loop through files managed by Assets.

{exp:assets:folders keywords="drink" recursive="yes"}
    <h3>{folder_name}</h3>
    <ul>
        {exp:assets:files folder_id="{folder_id}"}
            <li><a href="{url:huge}" target="_blank">{if title != ""}{title}{if:else}{filename}{/if}</a></li>
        {/exp:assets:files}
    </ul>
{/exp:assets:folders}

Tag Parameters

{exp:assets:files} supports the following parameters:

folder
The path of the folder containing the files you wish to output. Set this parameter in the format of either “{filedir_X}optional/subfolder/path” or “{source_X}optional/subfolder/path”. You may pass multiple IDs, delimited by pipes (‘|’). You can also use “any” or “*” to list from all folders.
folder_id
The ID of the folder containing the files you wish to output. You may pass multiple IDs, delimited by pipes (‘|’).
keywords
Search for files by their metadata values. You may pass multiple values, delimited by pipes (‘|’) or double-ampersands (‘&&’).
fixed_order
Search for files by their ID in the exp_assets_files table (same as the file_id param), and output them in the same order as they were entered into the param. You may pass multiple values, delimited by pipes (‘|’).
offset
Skips the first X files
limit
Limits the number of files to be returned
orderby

Orders the files by a specified property. Possible values include:

  • file_id
  • name
  • folder
  • date
  • size
sort
Sorts the results. Can be set to “desc” or “random”.

Note: Either the folder or folder_id param must be present for {exp:assets:files} to output anything.

Variable Tags

{exp:assets:files} supports the following variable tags:

{url}

The URL to the file.

{url:manipulation_name} is also available, for outputting the URL to an image manipulation.

{revved_url}
The revved URL to the file. The filename will be suffixed with a dot and the timestamp of when file was last modified. This will only work for files that are stored locally.
{server_path}

The server path to the file.

{server_path:manipulation_name} is also available, for outputting the server path to an image manipulation.

{subfolder}
The subfolder that the file lives in, if any.
{source_subfolder}
The value of the Subfolder setting on the file’s source, if there is one.
{folder_id}
Id of the folder containing the file.
{source_id}
Id of the source containing the file.
{filename}
The name of the file, sans-extension.
{extension}
The file extension.
{date_modified}
The date/time that the file was last modified. Supports the format parameter.
{kind}

The kind of file it is. Possible values are:

  • access
  • audio
  • excel
  • flash
  • html
  • illustrator
  • image
  • pdf
  • photoshop
  • php
  • text
  • video
  • word
{width}

The width of the image.

{width:manipulation_name} is also available, for outputting the width of an image manipulation.

{height}

The height of the image.

{height:manipulation_name} is also available, for outputting the height of an image manipulation.

{size}

The formatted size of the file (e.g. “20 KB”). You can also pass unformatted="yes" to get the raw file size in bytes.

{size:manipulation_name} is also available, for outputting the file size of an image manipulation.

{file_id}
The ID of the file (based on the id column in the exp_assets_files table).
{title}
The value of the file’s Title metadata field.
{date}
The value of the file’s Date metadata field. Supports the format parameter.
{alt_text}
The value of the file’s Alt Text metadata field.
{caption}
The value of the file’s Caption metadata field.
{author}
The value of the file’s Author/Credit/Producer metadata field.
{desc}
The value of the file’s Description metadata field.
{location}
The value of the file’s Location metadata field.
{total_files}
The total number of files being output.