Content Elements Tags
If you want to use an Assets field within Content Elements, use the following template:
{assets}
{files}
<img src="{url}" />
{/files}
{/assets}
Tag Parameters
The {files}
tag pair supports the following parameters:
folder_id
The ID of the folder containing the files you wish to output. You
may pass multiple IDs, delimited by pipes (‘|
’).
url
Search for files by URL. You may pass multiple values, delimited by pipes (‘|
’) or double-ampersands (‘&&
’). Prefix the value(s) with ‘=
’ for exact match searching.
server_path
Search for files by server path. You may pass multiple values, delimited by pipes (‘|
’) or double-ampersands (‘&&
’). Prefix the value(s) with ‘=
’ for exact match searching.
subfolder
Search for files by subfolder. You may pass multiple values, delimited by pipes (‘|
’) or double-ampersands (‘&&
’). Prefix the value(s) with ‘=
’ for exact match searching.
filename
Search for files by filename. You may pass multiple values, delimited by pipes (‘|
’) or double-ampersands (‘&&
’). Prefix the value(s) with ‘=
’ for exact match searching.
extension
Search for files by extension. You may pass multiple values, delimited by pipes (‘|
’) or double-ampersands (‘&&
’). Prefix the value(s) with ‘=
’ for exact match searching.
date_modified
Search for files by modified date (a Unix timestamp). You may pass multiple values, delimited by pipes (‘|
’) or double-ampersands (‘&&
’). Prefix the value(s) with ‘<
’ , ‘>
’ , ‘<=
’ or ‘>=
’ to match a range.
kind
Search for files by kind. You may pass multiple values, delimited by pipes (‘|
’) or double-ampersands (‘&&
’). Prefix the value(s) with ‘=
’ for exact match searching.
Posible values include:
access
audio
excel
flash
html
illustrator
image
pdf
photoshop
php
text
video
word
width
Search for images by width. You may pass multiple values, delimited by pipes (‘|
’) or double-ampersands (‘&&
’). Prefix the value(s) with ‘<
’ , ‘>
’ , ‘<=
’ or ‘>=
’ to match a range.
height
Search for images by height. You may pass multiple values, delimited by pipes (‘|
’) or double-ampersands (‘&&
’). Prefix the value(s) with ‘<
’ , ‘>
’ , ‘<=
’ or ‘>=
’ to match a range.
size
Search for files by size (in bytes). You may pass multiple values, delimited by pipes (‘|
’) or double-ampersands (‘&&
’). Prefix the value(s) with ‘<
’ , ‘>
’ , ‘<=
’ or ‘>=
’ to match a range.
file_id
Search for files by their ID in the exp_assets_files table. You may pass multiple values, delimited by pipes (‘|
’).
title
Search for files by their Title metadata value. You may pass multiple values, delimited by pipes (‘|
’) or double-ampersands (‘&&
’). Prefix the value(s) with ‘=
’ for exact match searching.
date
Search for files by their Date metadata value (a Unix timestamp). You may pass multiple values, delimited by pipes (‘|
’) or double-ampersands (‘&&
’). Prefix the value(s) with ‘<
’ , ‘>
’ , ‘<=
’ or ‘>=
’ to match a range.
alt_text
Search for files by their Alt Text metadata value. You may pass multiple values, delimited by pipes (‘|
’) or double-ampersands (‘&&
’). Prefix the value(s) with ‘=
’ for exact match searching.
caption
Search for files by their Caption metadata value. You may pass multiple values, delimited by pipes (‘|
’) or double-ampersands (‘&&
’). Prefix the value(s) with ‘=
’ for exact match searching.
author
Search for files by their Author/Credit/Producer metadata value. You may pass multiple values, delimited by pipes (‘|
’) or double-ampersands (‘&&
’). Prefix the value(s) with ‘=
’ for exact match searching.
desc
Search for files by their Description metadata value. You may pass multiple values, delimited by pipes (‘|
’) or double-ampersands (‘&&
’). Prefix the value(s) with ‘=
’ for exact match searching.
location
Search for files by their Location metadata value. You may pass multiple values, delimited by pipes (‘|
’) or double-ampersands (‘&&
’). Prefix the value(s) with ‘=
’ for exact match searching.
keywords
Search for files by their Keywords metadata value. You may pass multiple values, delimited by pipes (‘|
’) or double-ampersands (‘&&
’). Prefix the value(s) with ‘=
’ for exact match searching.
orderby
Order the files by a property or metadata value. Pair with the
sort
parameter to control the sort order.
sort
Sort the files in ascending or descending order (“asc
” and
“desc
”, respectively), by the property/metadata specified in
the orderby
parameter.
If the orderby
parameter was not set, sort="desc"
will
simply reverse the author-defined order of the files, and
sort="random"
will randomize the order of the files.
{my_assets_field orderby="title|kind|date" sort="asc|asc|desc"}
offset
Skip the first X files
{my_assets_field offset="{segment_4}" limit="1"}
limit
Limit the number of files to be returned
{my_assets_field limit="3"}
var_prefix
This parameter provides a way to avoid tag name conflicts by
namespacing each of Assets’ variable tags. So for example, if you
needed to access your current entry’s Title tag from within an Asset
field’s tag pair, you could do this:
{my_assets_field var_prefix="file"}
<a href="{file:url}">{title} - {file:title}</a>
{/my_assets_field}
Note: The {count}
tag won’t be affected by this parameter.
backspace
Strip the last X characters from the tag output
{my_assets_field backspace="2"}{filename}, {/my_assets_field}
Variable Tags
The following variable tags are available within the {files}
tag pair:
{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.