Using Treasury Template Tags

# Tag Parameters

Note

All parameters with an _operator suffix take the following values:

  • ==
  • !=
  • <
  • >
  • <=
  • >=
  • IN
  • NOT IN
{exp:treasury:files
    id="38|45"
    id_operator="!="

    location_id="1|3"
    location_id_operator="NOT IN"

    site_id="1|3"
    site_id_operator="IN"

    file_name="my_file.jpg"
    file_name_operator="=="

    uploaded_by_member_id="2|6"
    uploaded_by_member_id_operator="!="

    modified_by_member_id="2|6"
    modified_by_member_id_operator="!="

    width="200"
    width_operator=">"

    height="200"
    height_operator="<"

    limit="10"
    offset="10"

    order="file_name"
    sort="asc"

    namespace="my_namespace"
}

# Single Tag

{my_field}

{exp:treasury:files}

Using the tags as a single tag (not a tag pair), will output the matching file’s URL.

# Tag Pair

{my_field}{treasury:file_url}{/my_field}

{exp:treasury:files}{treasury:file_url}{/exp:treasury:files}

The tag pair will loop through the matching images and make all variables available within the tag pair.

Note

Examples assume the default namespace of treasury.

{exp:treasury:files}
    {treasury:id}
    {treasury:site_id}
    {treasury:title}
    {treasury:location_id}
    {if treasury:is_image}This is an image{/if}
    {treasury:mime_type}
    {treasury:file_name}
    {treasury:extension}
    {treasury:file_size}
    {treasury:description}
    {treasury:uploaded_by_member_id}
    {treasury:upload_date}
    {treasury:modified_by_member_id}
    {treasury:modified_date}
    {treasury:height}
    {treasury:width}
    {treasury:file_url}
    {treasury:thumb_url}
    {treasury:index}
    {treasury:count}
    {treasury:total}
    {treasury:total_results}

    {if treasury:no_results}No Files Found{/if}
{/exp:treasury:files}