<$mt:AssetCount$>

Returns the number of assets associated with the active blog.

Attributes:

type

Allows for filtering by file type. Built-in types supported are "image", "audio", "video". These types can be extended by plugins.

Example:

    Images available: <$mt:AssetCount type="image"$>
This page was last updated on 2007-10-01, 16:22.

2 Notes

If you have an image asset with thumbnails, this tag returns a count that includes both of them. If you want to only count images, a good want to do that is to use the MTAssets and MTSetVar tag like so (it loops through MTAssets - which only returns images, and not thumbnails - and increments the $asset_count variable which you can then use):

<$mt:SetVar name="assetcount" value="0"$> <mt:Assets> <$mt:SetVar name="assetcount" op="++"> </mt:Assets>

Assets: <$mt:Var name="asset_count">

You may like to use the following undocumented attributes for this tag:

singular="1 asset" plural="# assets" none="No assets"

Here is a sample of how you could use them:

<$mt:AssetCount singular="1 asset" plural="# assets" none="No assets"$>

The above would return:

"1 asset" or "9 assets" or "No assets".

You could customize the words "asset", "assets" and "No assets" from the above attributes.

Enjoy ;)

Leave a note

Have a question? Please use the MT Forums. Notes submitted on documentation should pertain to tips & hints regarding documentation. Your note may be removed once its contents have been integrated into the body of the page.