<mt:Assets>
A container tag which iterates (loops) over a list of assets from one or more blogs.
<mt:Assets>
<!-- tags here -->
</mt:Assets>
This container tag may contain any Asset function template tags.
Similarly, the mt:EntryAssets and mt:PageAssets tags will list all assets with the respective entry or page.
Attributes ¶
assets_per_rowauthordaysfile_exttypelastnlimitnamespaceoffsetsort_bysort_ordertaginclude_blogsexclude_blogsinclude_websitesexclude_websites
assets_per_row ¶
This attribute sets how many iterations the Assets tag publishes before setting the state that enables the AssetIsLastInRow AssetIsFirstInRow tags.
</mt:AssetIsLastInRow>
Supported values:
- intergers less than or equal to “100”
auto- which selects the most aesthetically pleasing number of items per row based on the total number of assets. For example, if you had 18 total assets, three rows of six would publish, but for 16 assets, four rows of four would publish.
author ¶
Selects assets uploaded by a single author.
Specify author’s username.
<mt:Assets author="beau">
<!-- tags here -->
</mt:Assets>
days ¶
Selects assets created in the last number of days specified.
<mt:Assets days="3">
<!-- tags here -->
</mt:Assets>
file_ext ¶
Selects assets by file extension.
Supports a comma-delimited list of file extensions.
<mt:Assets file_ext="gif, mp3, pdf">
<!-- tags here -->
</mt:Assets>
type ¶
Selects assets by asset type.
<mt:Assets file_ext="image">
<!-- tags here -->
</mt:Assets>
Supports a comma-delimited list of asset types:
imageaudiovideofile(new in MT5)
lastn ¶
Limits the selection of assets to the specified number.
<mt:Assets lastn="3">
<!-- tags here -->
</mt:Assets>
limit ¶
A positive integer to limit results.
<mt:Assets limit="3">
<!-- tags here -->
</mt:Assets>
namespace ¶
Used in conjunction with the sort_by attribute when sorting by “score”. The namespace identifies the method of scoring to use in sorting assets.
offset ¶
Used in coordination with lastn, starts N assets from the start of the list. N is a positive integer.
<mt:Assets lastn="1">
<!-- special treatment for first asset -->
</mt:Assets>
<mt:Assets lastn="9" offset="1">
<!-- alternate treatment for next 9 assets -->
</mt:Assets>
sort_by ¶
Sort assets by value.
<mt:Assets sort_by="label">
<!-- asset tags -->
</mt:Assets>
Supported values:
blog_idcreated_bycreated_ondescriptionfile_extfile_namefile_pathidlabelmime_typeparentscoreurl
sort_order ¶
Supported values:
ascenddescend
tag ¶
Selects assets with particular tags.
Supports expressions such as “interesting AND featured”).
<mt:Assets tag="foo AND bar">
<!-- tags here -->
</mt:Assets>
Examples ¶
<mt:Assets lastn="10" type="image" tag="favorite">
<a href="<mt:AssetURL>">
<img src="<mt:AssetThumbnailURL height="70">"
alt="<mt:AssetLabel escape="html">"
title="<mt:AssetLabel escape="html">" />
</a>
</mt:Assets>
Related ¶
- Template Loop Meta Variables offer conditionals for odd, even, first, last, and counter.
- MultiBlog template tags let you aggregate and publish assets from one or more blogs in your system, and apply criteria for filtering which assets are displayed.
mt:EntryAssetsmt:PageAssets
Jay Allen
November 1, 2007 7:59 PM | Reply
This tag supports the MultiBlog template tag attributes
blog_ids/include_blogsandexclude_blogsfor aggregating across different blogs.Brad
September 17, 2009 4:11 PM | Reply
I have tried using the file_ext=pdf and it does not work.
Mihai Bocsaru
November 6, 2009 8:36 AM | Reply
Yes Jay, the fact that this tag supports aggregating assets from other blogs should be better documented on this page about assets.
I've noticed this is possible and have advised people on the forum about it.
dewills
November 23, 2009 4:34 PM | Reply
When you are in the Manage Assets page, then Edit Asset page, the right side displays where the asset appears.
Is this information available here inside the Assets context?
MG
January 26, 2011 8:39 PM | Reply
You can limit the assets based on the Label as well.
A simplistic example: If you know your asset has the Label "foobar.jpg" then you can return all assets that have that label, and get that specific asset:
<mt:assets label="foobar.jpg"> <mt:assetLink /> </mt:assets>
In a more realistic case, you'd find the alt text of embedded images (which don't appear to be entry assets !??), search all Entries for an entry with the same label, get some details like the Description, and use that. (Hmmmm, will need some verification b/c it'd be possible to have identical labels. hmmm.)
MG
replied to comment from MG
January 30, 2011 11:43 AM | Reply
Bah, darnit. Please ignore my comment from January 26, 2011 8:39 PM; it looks like I was wrong. Moderator, feel free to delete that comment. thx.