MT Daily Builds Template Tags

From MovableType

Contents

New features in MT means new template tags so you can use those assets in your blog! These are template tags for MT Daily Builds Guide Check it out:

Container tags

MTAssets

A container tag which iterates over a list of assets--which assets depends on the context the tag is being used in. Within each iteration, you can use any of the MTAsset variable tags.

Contexts supported

  • Weblog Iterates through all assets that have been used by a weblog.
  • Tag iterates through all assets that are tagged "booter." (for a weblog, or entire system?)
  • System for MTE only

Asset Filtering Attributes

  • type (image|file) allows the user to select only images for a photo gallery, or only documents for a document listing.
  • file_ext (gif|jpg|doc|ppt|mp3 etc.) allows the user to do a more specific filtering on file type, so they could create a listing of just mp3 files, for example. Also, they can filter for file types that MT may not know about.
  • lastn
  • days
  • author
  • offset
  • tag

Sorting attributes

  • sort_by file_name | created_by | created_on
  • sort_order ascend | descend

Other attributes

  • assets_per_row when creating a photo gallery, this attribute sets how many iterations MTAssets goes through before setting the MTAssetIfLastItem to true. This makes creating a tabular view of assets very easy.
    • Supported values: an integer between 1 and 100.
    • Also supported would be the value "auto" which would cause MT to choose the most aesthetically pleasing number of items per row based on the total number of assets. For example, if you had 18 total assets to display, MT would display three rows of six, but if you had 16, it would do four rows of four.

MTAsset

Container tag which holds all information relating to a single asset. Within, all asset variable tags can be used to retreive metadata about the asset in question.

Asset Filtering Attributes

  • id

MTAssetTags

  • A container tag which iterates over a list of tags for an asset, or for all assets in the system.
  • Contexts supported
    • Asset
    • glue

MTAsset Variable tags

MTAssetID

  • Unique ID of the asset in question. Corresponds to the database field mt_asset.asset_id.
    • Example: 11

MTAssetFileName

  • The asset's file name.
    • Example: booter.jpg

MTAssetURL

  • URL that can be used to reach the asset.
    • Example: booter.jpg

MTAssetType

  • The type of asset in question: image or file
    • Example: image

MTAssetMimeType

  • The MIME type of the asset. This may be redundant or should supercede asset type.

MTAssetFilePath

  • Complete path to the file on the server.
    • Example: /var/www/html/assets/images/booter.jpg

MTAssetDateAdded

  • Date the asset was added to the system.
  • Optional Attributes
    • format
    • language
  • Example: 11/17/06 6:04:00 PM

MTAssetAddedBy

  • Username or display name of the user who added the asset to the system.
    • Example: James Joseph Brown

MTAssetProperty

  • Allows the user to access additional file metadata. Some of these properties will only make sense for certain file types. For example, image_width and image_height apply only to images.
    • file_size return asset file size
      • format numeric format (0|1|k|m) default is 1
        • 0: no formatted
        • 1: format by best size
        • k: format by kilo byte
        • m: format by mega byte
    • image_width return asset width (for image only, other type return 0)
    • image_height return asset heigth (for image only, other type return 0)
    • label return label value (we don't currently have this in the Asset Management spec)
    • description return description value (or this)
    • Example: 33kb, 100px, 90px

MTAssetFileExt

  • The file extension of the asset.
    • Example: jpg

MTAssetThumbnailURL

  • for images only
    • width hoped width of thumbnail image
    • height hoped height of thumbnail image
    • scale hoped scale(percent) of thumbnail image
    • For example: <a href="<$MTAssetURL$>"><img src="<$MTAssetThumbnailURL width="100"$>" /></a>

MTAssetLink

  • Produces a clickable link that would open the asset, either in the same browser window or in a new, pop-up window, depending on how new_window is set.

MTAssetThumbnailLink

  • Produces a link to the asset in question with a thumbnail preview. For obvious reasons, can only be used with image assets.
    • width: Desired width of thumbnail image
    • height: Desired height of thumbnail image
    • scale: Desired scale(percent) of thumbnail image
    • Example: <a href="http://www.fozboot.com/images/booter/jpg"><img src="booter_thumbnail.jpg" height=100 width=100></a>
    • Optional Attributes: new_window when set to 1, would open the image in a pop-up window.

MTAssetCount

  • Returns the number of assets in the system, blog or entry, depending on context.
  • Optional Attributes
    • type allowing for filtering by file type, so the count of only images could be returned, for example.
  • Supported Contexts
    • Weblog
    • Entry

Conditional tags

MTEntryIfAsset

  • Returns true when an entry has an asset associated witih it. Allows user to create a listing of entries, and display different formatting or a glyph for an entry that has associated assets.

MTAssetIfTagged

  • Returns true when an asset has associated asset tags. Allows the user to create a tag listing for an asset.
  • Asset Filtering Attributes
    • tag

MTAssetIsFirstInrow

  • Returns true when an asset is a head of row

MTAssetIsLastInrow

  • Returns true when an asset is a tail of row

MTAssetsHeader

  • Returns true when an asset is a first asset in the assets

MTAssetsFooter

  • Returns true when an asset is a last asset in the assets