Movable Type Template Tag Reference Manual

A

ActionStreams

This tag is a part of the Action Streams plugin bundled with Movable Type 4.25 and higher.

This block template tag shows the specified actions collected for the specified authors from their Action Stream profiles.

Example:

<mt:ActionStreams>
<mt:DateHeader>
<div>
<h3><$mt:StreamActionDate format="%b %d, %Y"$></h3>
<ul>
</mt:DateHeader>
<li class="service-<$mt:var name="service_type"$>">
<mt:StreamActionDate format="%H:%M"> - <$MTStreamAction$>
</li>
<mt:DateFooter>
</ul>
</div>
</mt:DateFooter>
</mt:ActionStreams>

Attributes:

AdminCGIPath

Returns the value of the AdminCGIPath configuration setting. Otherwise, the value of the CGIPath setting is returned.

If the value of AdminCGIPath or CGIPath is:

http://www.domain.com/cgi-bin/mt/

Or:

/cgi-bin/mt/

Default use of:

<$mt:AdminCGIPath$>

Will output:

http://www.domain.com/cgi-bin/mt/

In the event that the configured path has no domain (ie, “/cgi-bin/”), the domain of the blog in context will be used.

The path produced by this tag will always have an ending ‘/’, even if one does not exist as configured.

Values

Output will be a full url to the directory where the Movable Type CGI scripts exist.

Example

Publish “edit” links in index templates:

<a href="<$mt:AdminCGIPath$><$mt:AdminScript$>?__mode=view&_type=template&id=<$mt:BuildTemplateID$>&blog_id=<$mt:BlogID$>">Edit</a>

AdminScript

Returns the value of the AdminScript configuration directive.

Default use of:

<$mt:AdminScript$>

Will output:

mt.cgi

Values

The default value (if unspecified by the AdminScript config directive in mt-config.cgi) is mt.cgi

Examples

Publish “edit” links in index templates:

<a href="<$mt:AdminCGIPath$><$mt:AdminScript$>?__mode=view&_type=template&id=<$mt:BuildTemplateID$>&blog_id=<$mt:BlogID$>">Edit</a>

App:ActionBar

Produces markup for application templates for the strip of actions for a application listing or edit screen.

Attributes:

  • bar_position (optional; default "top")

    Assigns a CSS class name indicating whether the control is above or below the listing or edit form it is associated with.

  • hide_pager

    Assign either 1 or 0 to control whether the pagination controls are displayed or not.

  • form_id

    Associates the pagition controls and item action widget with the given form element.

App:Form

Used for application templates that need to express a standard MT application form. This produces certain hidden fields that are typically required by MT application forms.

Attributes:

  • action (optional)

    Identifies the URL to submit the form to. If not given, will use the current application URI.

  • method (optional; default "POST")

    Supplies the form method. "GET" or "POST" are the typical values for this, but will accept any HTTP-compatible method (ie: "PUT", "DELETE").

  • object_id (optional)

    Populates a hidden 'id' field in the form. If not given, will also use any 'id' template variable defined.

  • blog_id (optional)

    Populates a hidden 'blog_id' field in the form. If not given, will also use any 'blog_id' template variable defined.

  • object_type (optional)

    Populates a hidden '_type' field in the form. If not given, will also use any 'type' template variable defined.

  • id (optional)

    Used to form the 'id' element of the HTML form tag. If not specified, the form tag 'id' element will be assigned TYPE-form, where TYPE is the determined object_type.

  • name (optional)

    Supplies the form name attribute. If unspecified, will use the id attribute, if available.

  • enctype (optional)

    If assigned, sets an 'enctype' attribute on the form tag using the value supplied. This is typically used to create a form that is capable of uploading files.

Example:

    <mtapp:Form id="update" mode="update_blog_name">
        Blog Name: <input type="text" name="blog_name" />
        <input type="submit" />
    </mtapp:Form>

Producing:

    <form id="update" name="update" action="/cgi-bin/mt.cgi" method="POST">
    <input type="hidden" name="__mode" value="update_blog_name" />
        Blog Name: <input type="text" name="blog_name" />
        <input type="submit" />
    </form>

App:Link

Produces a application link to the current script with the mode and attributes specified.

Attributes:

  • mode

    Maps to a '__mode' argument.

  • type

    Maps to a '_type' argument.

Example:

    <$MTApp:Link mode="foo" type="entry" bar="1"$>

produces:

    /cgi-bin/mt/mt.cgi?__mode=foo&_type=entry&bar=1

This tag produces unescaped '&' characters. If you use this tag in an HTML tag attribute, be sure to add a escape="html" attribute which will encode these to HTML entities.

App:ListFilters

An application template tag used to produce an unordered list of quickfilters for a given listing screen. The filters are drawn from a list_filters template variable which is an array of hashes.

Example:

    <$mtapp:ListFilters$>

App:Listing

This application tag is used in MT application templates to produce a table listing. It expects an object_loop variable to be available, or you can use the loop attribute to have it use a different source.

It will output it's contents once for each row of the input array. It produces markup that is compatible with the MT application templates and CSS structure, so it is not meant for general blog publishing use.

The return_args variable is recognized and will populate a hidden field in the produced form tag if available.

The blog_id variable is recognized and will populate a hidden field in the produced form tag if available.

The screen_class variable is recognized and will force the hide_pager attribute to 1 if it is set to 'search-replace'.

The magic_token variable is recognized and will populate a hidden field in the produced form tag if available (or will retrieve a token from the current application if unset).

The view_expanded variable is recognized and will affect the class name applied to the table. If assigned, the table tag will receive a 'expanded' class; otherwise, it is given a 'compact' class.

The listing_header variable is recognized and will be output in a div tag (classed with 'listing-header') that appears at the top of the listing. This is only output when 'actions' are shown (see 'show_actions' attribute).

The structure of the output from a typical use like this:

    <MTApp:Listing type="entry">
        (contents of one row for table)
    </MTApp:Listing>

produces something like this:

    <div id="entry-listing" class="listing">
        <div class="listing-header">
        </div>
        <form id="entry-listing-form" class="listing-form"
            action="..../mt.cgi" method="post"
            onsubmit="return this['__mode'] ? true : false">
            <input type="hidden" name="__mode" value="" />
            <input type="hidden" name="_type" value="entry" />
            <input type="hidden" name="action_name" value="" />
            <input type="hidden" name="itemset_action_input" value="" />
            <input type="hidden" name="return_args" value="..." />
            <input type="hidden" name="blog_id" value="1" />
            <input type="hidden" name="magic_token" value="abcd" />
            <$MTApp:ActionBar bar_position="top"
                form_id="entry-listing-form"$>
            <table id="entry-listing-table"
                class="entry-listing-table compact" cellspacing="0">

                (contents of tag are placed here)

            </table>
            <$MTApp:ActionBar bar_position="bottom"
                form_id="entry-listing-form"$>
        </form>
    </div>

Attributes:

  • type (optional)

    The MT::Object object type the listing is processing. If unset, will use the contents of the object_type variable.

  • loop (optional)

    The source of data to process. This is an array of hashes, similar to the kind used with the Loop tag. If unset, the object_loop variable is used instead.

  • empty_message (optional)

    Used when there are no rows to output for the listing. If not set, it will process any 'else' block that is available instead, or, failing that, will output an App:StatusMsg tag saying that no data could be found.

  • id (optional)

    Used to construct the DOM id for the listing. The outer div tag will use this value. If unset, it will be assigned type-listing (where 'type' is the object type determined for the listing; see 'type' attribute).

  • listing_class (optional)

    Provides a custom class name that can be applied to the main div tag produced (this is in addition to the 'listing' class that is always applied).

  • action (optional; default 'script_url' variable)

    Supplies the 'action' attribute of the form tag produced.

  • hide_pager (optional; default '0')

    Controls whether the pagination controls are shown or not. If unspecified, pagination is shown.

  • show_actions (optional; default '1')

    Controls whether the actions associated with the object type processed are shown or not. If unspecified, actions are shown.

App:PageActions

An application template tag used to produce an unordered list of actions for a given listing screen. The actions are drawn from a page_actions template variable which is an array of hashes.

Example:

    <$mtapp:PageActions$>

App:Setting

An application template tag used to display an application form field.

Attributes:

  • id (required)

    Each application setting tag requires a unique 'id' attribute. This id should not be re-used within the template.

  • required (optional; default "0")

    Controls whether the field is displayed with visual cues that the field is a required field or not.

  • label

    Supplies the label phrase for the setting.

  • show_label (optional; default "1")

    Controls whether the label portion of the setting is shown or not.

  • shown (optional; default "1")

    Controls whether the setting is visible or not. If specified, adds a "hidden" class to the outermost div tag produced for the setting.

  • label_class (optional)

    Allows an additional CSS class to be applied to the label of the setting.

  • content_class (optional)

    Allows an addtional CSS class to be applied to the contents of the setting.

  • hint (optional)

    Supplies a "hint" phrase that provides inline instruction to the user. By default, this hint is hidden, unless the 'show_hint' attribute forces it to display.

  • show_hint (optional; default "0")

    Controls whether the inline help 'hint' label is shown or not.

  • warning

    Supplies a warning message to the user regarding the use of this setting.

  • show_warning

    Controls whether the warning message is shown or not.

  • help_page

    Identifies a specific page of the MT help documentation for this setting.

  • help_section

    Identifies a section name of the MT help documentation for this setting.

Example:

    <mtapp:Setting
        id="name"
        required="1"
        label="Username"
        hint="The username used to login">
            <input type="text" name="name" id="name" value="<$mt:Var name="name" escape="html"$>" />
    </mtapp:setting>

The basic structural output of a setting tag looks like this:

    <div id="ID-field" class="field pkg">
        <div class="field-inner">
            <div class="field-header">
                <label id="ID-label" for="ID">LABEL</label>
            </div>
            <div class="field-content">
                (content of App:Setting tag)
            </div>
        </div>
    </div>

App:SettingGroup

An application template tag used to wrap a number of App:Setting tags.

Attributes:

  • id (required)

    A unique identifier for this group of settings.

  • class (optional)

    If specified, applies this CSS class to the fieldset tag produced.

  • shown (optional; default "1")

    Controls whether the fieldset is initially shown or not. If hidden, a CSS "hidden" class is applied to the fieldset tag.

Example:

    <MTApp:SettingGroup id="foo">
        <MTApp:Setting ...>
        <MTApp:Setting ...>
        <MTApp:Setting ...>
    </MTApp:SettingGroup>

App:StatusMsg

An application template tag that outputs a MT status message.

Attributes:

  • id (optional)
  • class (optional; default "info")
  • rebuild (optional)

    Accepted values: "all", "index".

  • can_close (optional; default "1")

App:Widget

An application template tag that produces HTML for displaying a MT CMS dashboard widget. Custom widget templates should utilize this tag to wrap their widget content.

Attributes:

  • id (optional)

    If specified, will be used as the 'id' attribute for the outermost div tag for the widget. If unspecified, will use the 'widget_id' template variable instead.

  • label (required)

    The label to display above the widget.

  • label_link (optional)

    If specified, this link will wrap the label for the widget.

  • label_onclick

    If specified, this JavaScript code will be assigned to the 'onclick' attribute of a link tag wrapping the widget label.

  • class (optional)

    If unspecified, will use the id of the widget. This class is included in the 'class' attribute of the outermost div tag for the widget.

  • header_action
  • can_close (optional; default "0")

    Identifies whether widget may be closed or not.

  • tabbed (optional; default "0")

    If specified, the widget will be assigned an attribute that gives it a tabbed interface.

Example:

    <mtapp:Widget class="widget my-widget"
        label="<__trans phrase="All About Me">" can_close="1">
        (contents of widget go here)
    </mtapp:Widget>

ArchiveCategory

Deprecated: Use mt:CategoryLabel

Returns the label of the current category.

ArchiveCount

This tag will potentially return two different values depending upon the context in which it is invoked.

If invoked within Categories this tag will behave as if it was an alias to CategoryCount.

Otherwise it will return the number corresponding to the number of entries currently in context. For example within any Entries context, this tag will return the number of entries that that Entries tag corresponds to.

Example:

    <mt:Categories>
        There are <$mt:ArchiveCount$> entries in the <$mt:CategoryLabel$>
        category.
    </mt:Categories>

ArchiveDate

The starting date of the archive in context. For use with the Monthly, Weekly, and Daily archive types only. Date format tags may be applied with the format attribute along with the language attribute. See Date for attributes that are supported.

ArchiveDateEnd

The ending date of the archive in context. For use with the Monthly, Weekly, and Daily archive types only. Date format tags may be applied with the format attribute along with the language attribute. See Date tag for supported attributes.

Attributes:

  • format (optional)

    A string that provides the format in which to publish the date. If unspecified, the default that is appropriate for the language of the blog is used (for English, this is "%B %e, %Y %l:%M %p"). See the Date tag for the supported formats.

  • language (optional; defaults to blog language)

    Forces the date to the format associated with the specified language.

  • utc (optional; default "0")

    Forces the date to UTC time zone.

  • relative (optional; default "0")

    Produces a relative date (relative to current date and time). Suitable for dynamic publishing (for instance, from PHP or search result templates). If a relative date cannot be produced (the archive date is sufficiently old), the 'format' attribute will govern the output of the date.

Example:

    <$mt:ArchiveDateEnd$>

ArchiveFile

The archive filename including file extension for the archive in context. This can be controlled through the archive mapping section of the blog's Publishing settings screen.

Example: For the URL http://www.example.com/categories/politics.html, the ArchiveFile tag would output "politics.html".

Attributes:

  • extension

    set to '0' to exclude the file extension (ie, produce "politics" instead of "politics.html")

  • separator

    set to '-' to force any underscore characters in the filename to dashes

Example:

    <$mt:ArchiveFile$>

ArchiveLabel

An alias for the ArchiveTypeLabel tag.

Notes:

Deprecated in favor of the more specific tag: ArchiveTypeLabel

ArchiveLink

Publishes a link to the archive template for the current archive context. You may specify an alternate archive type with the "type" attribute to publish a different archive link.

Attributes:

  • type (optional)
  • archive_type (optional)

    Identifies the specific archive type to generate a link for. If unspecified, uses the current archive type in context, when publishing an archive template.

  • with_index (optional; default "0")

    If specified, forces any index filename to be included in the link to the archive page.

Example:

When publishing an entry archive template, you can use the following tag to get a link to the appropriate Monthly archive template relevant to that entry (in other words, if the entry was published in March 2008, the archive link tag would output a permalink for the March 2008 archives).

    <$MTArchiveLink type="Monthly"$>

ArchiveList

A container tag representing a list of all the archive pages of a certain type.

Attributes:

  • type or archive_type

    An optional attribute that specifies the type of archives to list. Recognized values are "Yearly", "Monthly", "Weekly", "Daily", "Individual", "Author", "Author-Yearly", "Author-Monthly", "Author-Weekly", "Author-Daily", "Category", "Category-Yearly", "Category-Monthly", "Category-Weekly" and "Category-Daily" (and perhaps others, if custom archive types are provided through third-party plugins). The default is to list the Preferred Archive Type specified in the blog settings.

  • lastn (optional)

    An optional attribute that can be used to limit the number of archives in the list.

  • sort_order (optional; default "descend")

    An optional attribute that specifies the sort order of the archives in the list. It is effective within any of the date-based and "Individual" archive types. Recognized values are "ascend" and "descend".

NOTE: You may produce an archive list of any supported archive type even if you are not publishing that archive type. However, the ArchiveLink tag will only work for archive types you are publishing.

Example:

    <mt:ArchiveList archive_type="Monthly">
        <a href="<$mt:ArchiveLink$>"><$mt:ArchiveTitle$></a>
    </mt:ArchiveList>

Here, we're combining two ArchiveList tags (the inner ArchiveList tag is bound to the date range of the year in context):

    <mt:ArchiveList type="Yearly" sort_order="ascend">
        <mt:ArchiveListHeader>
        <ul>
        </mt:ArchiveListHeader>
            <li><$mt:ArchiveDate format="%Y"$>
        <mt:ArchiveList type="Monthly" sort_order="ascend">
            <mt:ArchiveListHeader>
                <ul>
            </mt:ArchiveListHeader>
                    <li><$mt:ArchiveDate format="%b"$></li>
            <mt:ArchiveListFooter>
                </ul>
            </mt:ArchiveListFooter>
            </li>
        </mt:ArchiveList>
        <mt:ArchiveListFooter>
        </ul>
        </mt:ArchiveListFooter>
    </mt:ArchiveList>

to publish something like this:

    <ul>
        <li>2006
            <ul>
                <li>Mar</li>
                <li>Apr</li>
                <li>May</li>
            </ul>
        </li>
        <li>2007
            <ul>
                <li>Apr</li>
                <li>Jun</li>
                <li>Dec</li>
            </ul>
        </li>
    </ul>

ArchiveListFooter

The contents of this container tag will be displayed when the last entry listed by a ArchiveList tag is reached.

ArchiveListHeader

The contents of this container tag will be displayed when the first entry listed by a ArchiveList tag is reached.

ArchiveNext

A container tag that creates a context to the "next" archive relative to the current archive context.

This tag also works with the else tag to produce content if there is no "next" archive.

Attributes:

  • type or archive_type (optional)

    Specifies the "next" archive type the context is for. See the ArchiveList tag for supported values for this attribute.

Example:

    <mt:ArchiveNext>
      <a href="<$mt:ArchiveLink$>"
        title="<$mt:ArchiveTitle escape="html"$>">Next</a>
    <mt:Else>
       <!-- output when no next archive is available -->
    </mt:ArchiveNext>

ArchivePrevious

A container tag that creates a context to the "previous" archive relative to the current archive context.

This tag also works with the else tag to produce content if there is no "previous" archive.

Attributes:

  • type or archive_type (optional)

    Specifies the "previous" archive type the context is for. See the ArchiveList tag for supported values for this attribute.

Example:

    <mt:ArchivePrevious>
      <a href="<$mt:ArchiveLink$>"
        title="<$mt:ArchiveTitle escape="html"$>">Next</a>
    <mt:Else>
       <!-- output when no previous archive is available -->
    </mt:ArchivePrevious>

Archives

A container tag representing a list of all the enabled archive types in a blog. This tag exists to facilitate the publication of a Google sitemap or something of a similar nature.

Attributes:

  • type or archive_type (optional)

    Specify a comma-delimited list of archive types to loop over. If you only wish to publish a list of Individual and Category archives, you can specify:

        <mt:ArchiveList type="Individual,Category">

Example:

    <mt:Archives>
        <mt:ArchiveList><mt:ArchiveLink>
        </mt:ArchiveList>
    </mt:Archives>

This will publish a link for each archive type you publish (the primary archive links, at least).

ArchiveTitle

A descriptive title of the current archive. The value returned from this tag will vary based on the archive type:

  • Category

    The label of the category.

  • Daily

    The date in "Month, Day YYYY" form.

  • Weekly

    The range of dates in the week in "Month, Day YYYY - Month, Day YYYY"

  • Monthly

    The range of dates in the week in "Month YYYY" form.

  • Individual

    The title of the entry.

Example:

    <$mt:ArchiveTitle$>

ArchiveType

Publishes the identifier for the current archive type. Typically, one of "Daily", "Weekly", "Monthly", "Yearly", "Category", "Individual", "Page", etc.

  • A list of possible values values for type can be found on the EntryLink tag.

Example:

If used in an Individual Entry template:

<$mt:ArchiveType$>

Will output:

Individual

ArchiveTypeLabel

A descriptive label of the current archive type.

The value returned from this tag will vary based on the archive type:

Daily, Weekly, Monthly, Yearly, Author, Author Daily, Author Weekly, Author Monthly, Author Yearly, Category, Category Daily, Category Weekly, Category Monthly, Category Yearly

Example:

    <$mt:ArchiveTypeLabel$>

Related Tags: ArchiveType

Asset

Container tag that provides an asset context for a specific asset, from which all asset variable tags can be used to retreive metadata about that asset.

Attributes:

  • id

    The unique numeric id of the asset.

Example:

    <mt:Asset id="10">
        <$mt:AssetLabel$>
    </mt:Asset>

AssetAddedBy

Display name (or username if display name isn't assigned) of the user who added the asset to the system.

Example:

    <$mt:AssetAddedBy$>

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"$>

AssetDateAdded

The date the asset in context was added to Movable Type.

Attributes:

  • format

    A string that provides the format in which to publish the date. If unspecified, the default that is appropriate for the language of the blog is used (for English, this is "%B %e, %Y %l:%M %p"). See the Date tag for the supported formats.

  • language

    Forces the date to the format associated with the specified language.

  • utc

    Forces the date to UTC format.

Example:

    <$mt:AssetDateAdded$>

AssetDescription

This tag returns the description text of the asset currently in context.

Example:

    <$mt:AssetDescription$>

AssetFileExt

The file extension of the asset in context. For file-based assets only. Returns the file extension without the leading period (ie: "jpg").

Example:

    <$mt:AssetFileExt$>

AssetFileName

The file name of the asset in context. For file-based assets only. Returns the file name without the path (i.e. file.jpg, not /home/user/public_html/images/file.jpg).

Example:

    <$mt:AssetFileName$>

AssetFilePath

Path information of the asset in context. For file-based assets only. Returns the local file path with the name of the file (i.e. /home/user/public_html/images/file.jpg).

Example:

    <$mt:AssetFilePath$>

AssetID

A numeric system ID of the Asset currently in context.

Example:

    <$mt:AssetID$>

AssetIfTagged

This template tag evaluates a block of code if a tag has been assigned to the current asset in context.

If the tag attribute is not assigned, then the template tag will evaluate if any tag is present.

Check for a specific tag…

<mt:AssetIfTagged tag="Foo">
    This asset has the tag "Foo"
</mt:AssetIfTagged>

Check if any tags are assigned to the asset…

<mt:AssetIfTagged>
    This asset has tags
</mt:AssetIfTagged>

Context

Attributes

tag

If present, the template tag will evaluate if the specified tag is assigned to the current asset.

Example

Conditional if tagged “Foo” or not:

<mt:AssetIfTagged tag="Foo">
    <!-- do something -->
<mt:Else>
    <!-- do something else -->
</mt:AssetIfTagged>

Condition based upon if a asset is tagged with the private tag @draft:

<mt:Assets>
    <li class="asset <mt:AssetIfTagged tag="@draft">draft</mt:AssetIfTagged>">
        <a href="<$mt:AssetURL$>"><$mt:AssetLabel$></a>
        <mt:AssetIfTagged tag="@draft">(draft)</mt:AssetIfTagged>
    </li>
</mt:Assets>

Bugs

Related

AssetIsFirstInRow

A conditional tag that displays its contents if the asset in context is the first item in the row in context when publishing a grid of assets (e.g. thumbnails). Grid of assets can be created by specifying assets_per_row attribute value to Assets block tag.

For example, the first, the fourth and the seventh asset are the first assets in row when Assets iterates eight assets and assets_per_row is set to "3".

Example:

    <table>
      <mt:Assets type="image" assets_per_row="4">
        <mt:AssetIsFirstInRow><tr></mt:AssetIsFirstInRow>
          <td><$mt:AssetThumbnailLink$></td>
        <mt:AssetIsLastInRow></tr></mt:AssetIsLastInRow>
      </mt:Assets>
    </table>

AssetIsLastInRow

A conditional tag that displays its contents if the asset in context is the last item in the row in context when publishing a grid of assets (e.g. thumbnails). Grid of assets can be created by specifying assets_per_row attribute value to Assets block tag.

For example, the third, the sixth and the eighth asset are the last assets in row when Assets iterates eight assets and assets_per_row is set to "3".

Example:

    <table>
      <mt:Assets type="image" assets_per_row="4">
        <mt:AssetIsFirstInRow><tr></mt:AssetIsFirstInRow>
          <td><$mt:AssetThumbnailLink$></td>
        <mt:AssetIsLastInRow></tr></mt:AssetIsLastInRow>
      </mt:Assets>
    </table>

AssetLabel

Returns the label of the asset in context. Label can be specified upon uploading a file.

Example:

    <$mt:AssetLabel$>

AssetLink

Returns HTML anchor tag for the asset in context. For example, if the URL of the asset is http://example.com/image.jpg, the tag returns <a href="http://example.com/image.jpg">image.jpg</a>.

Attributes:

  • new_window (optional; default "0")

    Specifies if the tag generates 'target="_blank"' attribute to the anchor tag.

Example:

    <$mt:AssetLink$>

AssetMimeType

Returns MIME type of the asset in context. MIME type of a file is typically provided by web browser upon uploading.

Example:

    <$mt:AssetMimeType$>

AssetProperty

Returns the additional metadata of the asset in context. Some of these properties only make sense for certain file types. For example, image_width and image_height apply only to images.

Attributes:

  • property (required)

    Specifies what property to return from the tag. Supported attribute values:

    • file_size

      asset's file size

    • image_width

      asset's width (for image only; otherwise returns 0)

    • image_height

      asset's height (for image only; otherwise returns 0)

    • description

      asset's description

  • format

    Used in conjunction with file_size property. Supported attribute values:

    • return raw size
    • 1 (default)

      auto format depending on the size

    • k

      size expressed in kilobytes

    • m

      size expressed in megabytes

AssetRank

A function tag which returns a number from 1 to 6 (by default) which represents the rating of the asset in context in terms of total score where '1' is used for the highest score, '6' for the lowest score.

Attributes:

  • namespace (required)

    Specify namespace for rank to be calculated. Namespace is defined by each plugin which leverages rating API.

  • max (optional; default "6")

    Allows a user to specify the upper bound of the scale.

Example:

    <$mt:AssetRank namespace="FiveStarRating"$>

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_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:

  • image
  • audio
  • video
  • file (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_id
  • created_by
  • created_on
  • description
  • file_ext
  • file_name
  • file_path
  • id
  • label
  • mime_type
  • parent
  • score
  • url

sort_order

Supported values:

  • ascend
  • descend

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

AssetScore

A function tag that provides total score of the asset in context. Scores grouped by namespace of a plugin are summed to calculate total score of an asset.

Attributes:

  • namespace (required)

    Specify namespace for score to be calculated. Namespace is defined by each plugin which leverages rating API.

Example:

    <$mt:AssetScore namespace="FiveStarRating"$>

AssetScoreAvg

A function tag that provides the avarage score of the asset in context. Scores grouped by namespace of a plugin are summed to calculate total score of an asset, and average is calculated by dividing the total score by the number of scorings or 'votes'.

Attributes:

  • namespace (required)

    Specify namespace for avarage score to be calculated. Namespace is defined by each plugin which leverages rating API.

Example:

    <$mt:AssetScoreAvg namespace="FiveStarRating"$>

AssetScoreCount

A function tag that provides the number of scorings or 'votes' made to the asset in context. Scorings grouped by namespace of a plugin are summed.

Attributes:

  • namespace (required)

    Specify namespace for the number of scorings to be calculated. Namespace is defined by each plugin which leverages rating API.

Example:

    <$mt:AssetScoreCount namespace="FiveStarRating"$>

AssetScoreHigh

A function tag that provides the highest score of the asset in context. Scorings grouped by namespace of a plugin are sorted to find the highest score of an asset.

Attributes:

  • namespace (required)

    Specify namespace for the score to be sorted. Namespace is defined by each plugin which leverages rating API.

Example:

    <$mt:AssetScoreHigh namespace="FiveStarRating"$>

AssetScoreLow

A function tag that provides the lowest score of the asset in context. Scorings grouped by namespace of a plugin are sorted to find the lowest score of an asset.

Attributes:

  • namespace (required)

    Specify namespace for the score to be sorted. Namespace is defined by each plugin which leverages rating API.

Example:

    <$mt:AssetScoreLow namespace="FiveStarRating"$>

AssetsFooter

The contents of this container tag will be displayed when the last entry listed by a Assets tag is reached.

AssetsHeader

The contents of this container tag will be displayed when the first entry listed by a Assets tag is reached.

AssetTags

A container tag used to output infomation about the asset tags assigned to the asset in context.

To avoid printing out the leading text when no asset tags are assigned you can use the AssetIfTagged conditional block to first test for asset tags on the asset. You can also use the AssetIfTagged conditional block with the tag attribute to test for the assignment of a particular entry tag.

Attributes:

  • glue

    A text string that is used to join each of the items together. For example:

        <mt:AssetTags glue=", "><$mt:TagName$></mt:AssetTags>

    would print out each tag name separated by a comma and a space.

Example:

The following code can be used anywhere Assets can be used. It prints a list of all of the tags assigned to each asset returned by Assets glued together by a comma and a space.

    <mt:If tag="AssetTags">
        The asset "<$mt:AssetLabel$>" is tagged:
        <mt:AssetTags glue=", "><$mt:TagName$></mt:AssetTags>
    </mt:If>

AssetThumbnailLink

Produces a thumbnail image, linked to the image asset currently in context.

Attributes:

  • height

    The height of the thumbnail to generate. If this is the only parameter specified then the thumbnail's width will be scaled proportionally to the height.

  • width

    The width of the thumbnail to generate. If this is the only parameter specified then the thumbnail's height will be scaled proportionally to the width.

  • scale

    The percentage by which to reduce or increase the size of the current asset.

  • new_window (optional; default "0")

    If set to '1', causes the link to open a new window to the linked asset.

AssetThumbnailURL

Returns the URL for a thumbnail you wish to generate for the current asset in context.

Attributes:

  • height

    The height of the thumbnail to generate. If this is the only parameter specified then the thumbnail's width will be scaled proportionally to the height.

  • width

    The width of the thumbnail to generate. If this is the only parameter specified then the thumbnail's height will be scaled proportionally to the width.

  • scale

    The percentage by which to reduce or increase the size of the current asset.

  • square

    If set to 1 (one) then the thumbnail generated will be square, where the length of each side of the square will be equal to the shortest side of the image.

Example:

The following will output thumbnails for all of the assets embedded in all of the entries on the system. Each thumbnail will be square and have a max height/width of 100 pixels.

    <mt:Entries>
        <mt:EntryAssets>
            <$mt:AssetThumbnailURL width="100" square="1"$>
        </mt:EntryAssets>
    </mt:Entries>

AssetType

Returns the localized name for the type of asset currently in context. For instance, for an image asset, this will tag will output (for English blogs), "image".

Example:

    <$mt:AssetType$>

AssetURL

Produces a permalink for the uploaded asset.

Example:

    <$mt:AssetURL$>

AtomScript

Returns the value of the AtomScript configuration setting. The default for this setting if unassigned is "mt-atom.cgi".

AuthorAuthIconURL

Returns URL to a small (16x16) image represents in what authentication provider the author in context is authenticated. For most of users it will be a small spanner logo of Movable Type. If user is a commenter, icon image is provided by each of authentication provider. Movable Type provides images for Vox, LiveJournal and OpenID out of the box.

Attributes:

  • size (optional; default "logo_small")

    Identifies the requested size of the logo. This is an identifier, not a dimension in pixels. And, currently, "logo_small" is the only supported identifier.

Example:

    <mt:Authors>
        <img src="<$mt:AuthorAuthIconURL$>" height="16" width="16" />
        <$mt:AuthorDisplayName$>
    </mt:Authors>

AuthorAuthType

Outputs the authentication type identifier for the author currently in context. For Movable Type registered users, this is "MT".

AuthorBasename

Outputs the 'Basename' field of the author currently in context.

AuthorCustomFieldDescription

Deprecated: Same as mt:CustomFieldDescription. See EntryCustomFields for more info.

This will display the description of the current custom field in context.

AuthorCustomFieldName

Deprecated: Same as mt:CustomFieldValue. See EntryCustomFields for more info.

This will display the value of the current custom field in context.

AuthorCustomFields

This container tag iterates, or loops, over the list of custom fields associated with an author.

See mt:EntryCustomFields for more details.

<mt:Authors>
    <mt:AuthorCustomFields>
        <$mt:CustomFieldName$>
    </mt:AuthorCustomFields>
</mt:Authors>

Attributes

exclude

Custom field name of the field you wish to exclude from the loop.

<mt:AuthorCustomFields exclude="Foo Field">
    <$mt:CustomFieldName$>
</mt:AuthorCustomFields>

Examples

See mt:EntryCustomFields for more examples.

Related

AuthorCustomFieldValue

Deprecated: Same as mt:CustomFieldValue. See EntryCustomFields for more info.

This will display the value of the current custom field in context.

AuthorDisplayName

Outputs the display name of the author currently in context. If no author is in context, it will use the author of the entry or page in context.

AuthorEmail

Outputs the email address of the author currently in context. If no author is in context, it will use the author of the entry or page in context.

NOTE: it is not recommended to publish the author's email address.

AuthorFavoriteEntries

This template tag returns a list of entries flagged as a favorite by the current author in context. Typically used on the user profile template.

See <mt:Entries> for more info.

AuthorHasEntry

A conditional tag that is true when the author currently in context has written one or more entries that have been published.

    <mt:AuthorHasEntry>
    <a href="<$mt:ArchiveLink type="Author">">Archive for this author</a>
    </mt:AuthorHasEntry>

AuthorHasPage

A conditional tag that is true when the author currently in context has written one or more pages that have been published.

AuthorID

Outputs the numeric ID of the author currently in context. If no author is in context, it will use the author of the entry or page in context.

AuthorName

Outputs the username of the author currently in context. If no author is in context, it will use the author of the entry or page in context.

NOTE: it is not recommended to publish the author's username.

AuthorNext

A container tag which creates a author context of the next author. The order of authors is determined by author's login name. Authors who have at least a published entry will be considered in finding the next author.

Example:

    <mt:AuthorNext>
        <a href="<$mt:ArchiveLink archive_type="Author"$>"><$mt:AuthorDisplayName$></a>
    </mt:AuthorNext>

AuthorPrevious

A container tag which creates a author context of the previous author. The order of authors is determined by author's login name. Authors who have at least a published entry will be considered in finding the previous author.

Example:

    <mt:AuthorPrevious>
        <a href="<$mt:ArchiveLink archive_type="Author"$>"><$mt:AuthorDisplayName$></a>
    </mt:AuthorPrevious>

AuthorRank

A function tag which returns a number from 1 to 6 (by default) which represents the rating of the author in context in terms of total score where '1' is used for the highest score, '6' for the lowest score.

Attributes:

  • namespace (required)

    Specify namespace for rank to be calculated. Namespace is defined by each plugin which leverages rating API.

  • max (optional; default "6")

    Allows a user to specify the upper bound of the scale.

Example:

    <$mt:AuthorRank namespace="FiveStarRating"$>

Authors

A container tag which iterates over a list of authors (users with a permission).

Default listing includes Authors who have at least one published entry.

<mt:Authors>
    <$mt:AuthorDisplayName$>
</mt:Authors>

Attributes

All fields are optional.

any_type

Pass a value of “1” for this attribute to select users of any type associated with the blog, including commenters. Default is “0”. Requires the use of need_entry="0"

Display all authors of any type in the installation:

<mt:Authors any_type="1" need_entry="0">
    <li><$mt:AuthorDisplayName$> [<$mt:AuthorID$>]</li>
</mt:Authors>

Bug: any_type attribute of mt:Authors doesn’t work as expected

display_name

Specifies the displpay name a particular author to select.

<mt:Authors display_name="Melody Nelson">
    <!-- do something -->
</mt:Authors>

id

Specifies a particular author to select by unique id number. This attribute takes precedence over all others.

<mt:Authors id="12">
    <!-- do something -->
</mt:Authors>

lastn

Limits the selection of authors to the specified number. Has nothing to do with recent (as in recent dates) as lastn does for most other loop tags.

Limit the result to 4 newly creatd authors (using sort_by and sort_order attributes).

<mt:Authors lastn="4" sort_by="created_on" sort_order="descend">
    <!-- do something -->
</mt:Authors>

limit

Alias to lastn.

min_score

If ‘namespace’ is also specified, filters the authors based on the score within that namespace. This specifies the minimum score to consider the author for inclusion.

max_score

If ‘namespace’ is also specified, filters the authors based on the score within that namespace. This specifies the maximum score to consider the author for inclusion.

min_rate

If ‘namespace’ is also specified, filters the authors based on the rank within that namespace. This specifies the minimum rank to consider the author for inclusion.

max_rate

If ‘namespace’ is also specified, filters the authors based on the rank within that namespace. This specifies the maximum rank to consider the author for inclusion.

min_count

If ‘namespace’ is also specified, filters the authors based on the count within that namespace. This specifies the minimum count to consider the author for inclusion.

max_count

If ‘namespace’ is also specified, filters the authors based on the count within that namespace. This specifies the maximum count to consider the author for inclusion.

namespace

Used in conjunction with the “min_*” and “max_*” attributes to select authors based on a particular scoring mechanism.

need_entry

Boolean identifer to determine whether the author(s) must have published an entry to be included or not. Default “1”, author needs to have published an entry.

Select all authors with “Author” role regardless of whether they have any entries associated to them.

<mt:Authors role="Author" need_entry="0">
    <$mt:AuthorDisplayName$>
</mt:Authors>

need_association

Boolean identifier to require author(s) to have explicit association to the blog(s) in context. This attribute can be used to exclude system administrators who do not have explicit association to the blog(s). This attribute requires blog context which can be created by includeblogs, excludeblogs, and blog_ids. Default is “0”

role

A the role(s) used to filter returned authors.

Value can be a comma separated list of roles (which will be converted to a list of roles separated with ” OR “):

<mt:Authors role="Author, Contributor">

Or roles can be specified directly with the “OR” operator:

<mt:Authors role="Author OR Contributor">

Select all users with the role “Editor”:

<mt:Authors role="Editor">

Select all users with the role NOT “Editor”:

<mt:Authors role="!(Editor)">

Bug: Role attribute of mt:Authors using NOT syntax lists authors not associated to the current blog

roles

Alias of role.

scoring_to

If ‘namespace’ is also specified, filters the authors based on the score within that namespace. This attribute specifies which type of object to look up. the object has to be specified in context.

sort_by

Sort by author data. See lastn for example.

Supported values:

  • display_name
  • name
  • created_on
  • score
  • rate

sort_order

Order of returned authors. See lastn for example.

Supported values:

  • ascend (default)
  • descend

status

Supported values:

  • enabled (default)
  • disabled

username

Specifies the username a particular author to select. Like the id attribute, this attribute takes precedence over all others.

<mt:Authors display_name="Melody Nelson">
    <!-- do something -->
</mt:Authors>

The username and id should never be used together because they are both idetifiers for a particular user.

Examples

List all Authors in a blog with at least 1 entry:

<mt:Authors>
   <a href="<$mt:AuthorURL$>"><$mt:AuthorDisplayName$></a>
</mt:Authors>

List all Authors and Commenters for a blog:

<mt:Authors need_entry="0" roles="Author, Commenter">
    <a href="<$mt:AuthorURL$>"><mt:AuthorDisplayName$></a>
</mt:Authors>

Related

AuthorScore

A function tag that provides total score of the author in context. Scores grouped by namespace of a plugin are summed to calculate total score of an author.

Attributes:

  • namespace (required)

    Specify namespace for score to be calculated. Namespace is defined by each plugin which leverages rating API.

Example:

    <$mt:AuthorScore namespace="FiveStarRating"$>

AuthorScoreAvg

A function tag that provides the avarage score of the author in context. Scores grouped by namespace of a plugin are summed to calculate total score of an author, and average is calculated by dividing the total score by the number of scorings or 'votes'.

Attributes:

  • namespace (required)

    Specify namespace for avarage score to be calculated. Namespace is defined by each plugin which leverages rating API.

Example:

    <$mt:AuthorScoreAvg namespace="FiveStarRating"$>

AuthorScoreCount

A function tag that provides the number of scorings or 'votes' made to the author in context. Scorings grouped by namespace of a plugin are summed.

Attributes:

  • namespace (required)

    Specify namespace for the number of scorings to be calculated. Namespace is defined by each plugin which leverages rating API.

Example:

    <$mt:AuthorScoreCount namespace="FiveStarRating"$>

AuthorScoreHigh

A function tag that provides the highest score of the author in context. Scorings grouped by namespace of a plugin are sorted to find the highest score of an author.

Attributes:

  • namespace (required)

    Specify namespace for the score to be sorted. Namespace is defined by each plugin which leverages rating API.

Example:

    <$mt:AuthorScoreHigh namespace="FiveStarRating"$>

AuthorScoreLow

A function tag that provides the lowest score of the author in context. Scorings grouped by namespace of a plugin are sorted to find the lowest score of an author.

Attributes:

  • namespace (required)

    Specify namespace for the score to be sorted. Namespace is defined by each plugin which leverages rating API.

Example:

    <$mt:AuthorScoreLow namespace="FiveStarRating"$>

AuthorURL

Outputs the URL field of the author currently in context. If no author is in context, it will use the author of the entry or page in context.

AuthorUserpic

This template tags returns a complete HTML <img> tag representing the current author's userpic. For example:

    <img src="http://www.yourblog.com/path/to/userpic.jpg"
        width="100" height="100" />

AuthorUserpicAsset

This container tag creates a context that contains the userpic asset for the current author. This then allows you to use all of Movable Type's asset template tags to display the userpic's properties.

    <ul><mt:Authors>
         <mt:AuthorUserpicAsset>
           <li>
             <img src="<$mt:AssetThumbnailURL width="20" height="20"$>"
                width="20" height="20"  />
             <$mt:AuthorName$>
           </li>
         </mt:AuthorUserpicAsset>
    </mt:Authors></ul>

AuthorUserpicURL

This template tag returns the fully qualified URL for the userpic of the author currently in context.

If the author has no userpic, this will output an empty string.

B

BlogArchiveURL

Outputs the Archive URL of the blog currently in context. An ending '/' character is guaranteed.

BlogCategoryCount

Returns the number of categories associated with a blog.

If a blog has 4 categories, using the following tag will output “4”:

<$mt:BlogCategoryCount$>

This template tag supports the multiblog template tags.

This template tag also supports all of the same filtering mechanisms defined by the mt:Categories tag allowing users to retrieve a count of the number of comments on a blog that meet a certain criteria.

BlogCCLicenseImage

Publishes the URL of the Creative Commons logo appropriate to the license assigned to the blog in context. If the blog doesn't have a Creative Commons license, this tag returns an empty string.

Example:

    <MTIf tag="BlogCCLicenseImage">
    <img src="<$MTBlogCCLicenseImage$>" alt="Creative Commons" />
    </MTIf>

BlogCCLicenseURL

Publishes the license URL of the Creative Commons logo appropriate to the license assigned to the blog inc ontex.t If the blog doesn't have a Creative Commons license, this tag returns an empty string.

BlogCommentCount

Returns the number of published comments associated with the blog currently in context.

BlogDescription

Outputs the description field of the blog currently in context.

BlogEntryCount

Returns the number of published entries associated with the blog currently in context.

This template tag supports the multiblog template tags.

This template tag also supports all of the same filtering mechanisms defined by the <mt:Entries> tag allowing users to retrieve a count of the number of entries on a blog that meet a certain criteria.

Example

If a blog had 23 entries

<$mt:BlogEntryCount$>

will output the number

23

BlogFileExtension

Returns the configured blog filename extension, including a leading '.' character. If no extension is assigned, this returns an empty string.

BlogHost

The host name part of the absolute URL of your blog.

Attributes:

  • exclude_port (optional; default "0")

    Removes any specified port number if this attribute is set to true (1), otherwise it will return the hostname and port number (e.g. www.somedomain.com:8080).

  • signature (optional; default "0")

    If set to 1, then this template tag will instead return a unique signature for the hostname, by replacing all occurrences of decimals (".") with underscores ("_").

BlogID

Outputs the numeric ID of the blog currently in context.

BlogIfCCLicense

A conditional tag that is true when the current blog in context has been assigned a Creative Commons License.

BlogIfCommentsOpen

A conditional tag that returns true when: the system is configured to allow comments and the blog is configured to accept comments in some fashion.

BlogLanguage

The blog's specified language for date display. This setting can be changed on the blog's Entry settings screen.

Attributes:

  • locale (optional; default "0")

    If assigned, will format the language in the style "language_LOCALE" (ie: "en_US", "de_DE", etc).

  • ietf (optional; default "0")

    If assigned, will change any '_' in the language code to a '-', conforming it to the IETF RFC # 3066.

BlogName

Outputs the name of the blog currently in context.

BlogPageCount

The number of published pages in the blog. This template tag supports the multiblog template tags.

Example:

    <$mt:BlogPageCount$>

BlogPingCount

Returns a count of published TrackBack pings associated with the blog currently in context.

BlogRelativeURL

Similar to the BlogURL tag, but removes any domain name from the URL.

BlogResultFooter

The contents of this container tag will be displayed when the blog id of the entry in context from search results differs from the next entry's blog id.

This tag is only recognized in search templates.

BlogResultHeader

The contents of this container tag will be displayed when the blog id of the entry in context from search results differs from the previous entry's blog id.

This tag is only recognized in search templates.

Blogs

A container tag which iterates over a list of all of the blogs in the system. You can use any of the blog tags (BlogName, BlogURL, etc - anything starting with MTBlog) inside of this tag set.

Attributes:

  • blog_ids

    This attribute allows you to limit the set of blogs iterated over by Blogs. Multiple blogs are specified in a comma-delimited fashion. For example:

        <mt:Blogs blog_ids="1,12,19,37,112">

    would iterate over only the blogs with IDs 1, 12, 19, 37 and 112.

BlogSitePath

Outputs the Site Root field of the blog currently in context. An ending '/' character is guaranteed.

BlogTemplateSetID

Returns an identifier for the currently assigned template set for the blog in context. The identifier is modified such that underscores are changed to dashes. In the MT template sets, this identifier is assigned to the "id" attribute of the body HTML tag.

BlogTimezone

The timezone that has been specified for the blog displayed as an offset from UTC in +|-hh:mm format. This setting can be changed on the blog's General settings screen.

Attributes:

  • no_colon (optional; default "0")

    If specified, will produce the timezone without the ":" character ("+|-hhmm" only).

BlogURL

Outputs the Site URL field of the blog currently in context. An ending '/' character is guaranteed.

BuildTemplateID

Returns the ID of the template (index, archive or system template) currently being built.

Examples

Publish “edit” links in index templates:

<a href="<$mt:AdminCGIPath$><$mt:AdminScript$>?__mode=view&_type=template&id=<$mt:BuildTemplateID$>&blog_id=<$mt:BlogID$>">Edit</a>

C

Calendar

A container tag representing a calendar month that lists a single calendar "cell" in the calendar display.

Attributes:

  • month

    An optional attribute that specifies the calendar month and year the tagset is to generate. The value must be in YYYYMM format. The month attribute also recognizes two special values. Given a value of "last", the calendar will be generated for the previous month from the current date. Using a value of "this" will generate a calendar for the current month.

    The default behavior is to generate a monthly calendar based on the archive in context. When used in the context of an archive type other then "Category," the calendar will be generated for the month in which the archive falls.

  • category

    An optional attribute that specifies the name of a category from which to return entries.

Example:

To produce a calendar for January, 2002 of entries in the category "Foo":

    <mt:Calendar month="200201" category="Foo">
        ...
    </mt:Calendar>

CalendarCellNumber

The number of the "cell" in the calendar, beginning with 1. The count begins with the first cell regardless of whether a day of the month falls on it. This tag may only be used inside a Calendar tag.

Example:

    <$mt:CalendarCellNumber$>

CalendarDate

The timestamp of the current day of the month. Date format tags may be applied with the format attribute along with the language attribute.

Example:

    <$mt:CalendarDate$>

CalendarDay

The numeric day of the month for the cell of the calendar being published. This tag may only be used inside a Calendar tag.

Example:

    <$mt:CalendarDay$>

CalendarIfBlank

A conditional tag that will display its contents if the current calendar cell is for a day in another month.

Example:

    <mt:CalendarIfBlank>&nbsp;</mt:CalendarIfBlank>

CalendarIfEntries

A conditional tag that will display its contents if there are any entries for this day in the blog.

Example

<mt:CalendarIfEntries>
    <mt:Entries limit="1">
    <a href="<$mt:ArchiveLink type="Daily"$>">
        <$mt:CalendarDay$>
    </a>
    </mt:Entries>
</mt:CalendarIfEntries>

Related

CalendarIfNoEntries

A conditional tag that will display its contents if there are not entries for this day in the blog. This tag predates the introduction of Else, a tag that could be used with CalendarIfEntries to replace CalendarIfNoEntries.

CalendarIfToday

A conditional tag that will display its contents if the current cell is for the current day.

CalendarWeekFooter

A conditional tag that will display its contents before a calendar week is ended.

Example:

    <mt:CalendarWeekFooter></tr></mt:CalendarWeekFooter>

CalendarWeekHeader

A conditional tag that will display its contents before a calendar week is started.

Example:

    <mt:CalendarWeekHeader><tr></mt:CalendarWeekHeader>

CaptchaFields

Returns the HTML markup necessary to display the CAPTCHA on the published blog. The value returned is escaped for assignment to a JavaScript string, since the CAPTCHA field is displayed through the MT JavaScript code.

Example:

    var captcha = '<$mt:CaptchaFields$>';

Categories

Produces a list of categories defined for the current blog.

Categories in this blog:
<mt:Categories glue=", ">
    <a href="<$mt:CategoryArchiveLink$>"><$mt:CategoryLabel$></a>
</mt:Categories>

This tag produces output for every category with no regard to their hierarchical structure. The results are sorted ascending by category label.

The tags mt:TopLevelCategories and mt:SubCategories may be more useful for complex listings of categories.

Attributes

blog_ids

A comma delimited list of blog ids specifying which blogs to include categories from, or the word “all” to include categories from all blogs in the installation.

This attribute aggregates categories from multiple blogs:

<mt:Categories blog_ids="1,12,19,37,112">

A value of “all” expands the context to all blogs (in the installation) except those blogs which have been explicitly forbidden their content from being aggregated in the Multiblog blog plugin settings.

<mt:Categories blog_ids="all">

Alias of include_blogs.

class_type

Accepted values are “category” (default) and “folder”. Because folders are essentially categories for pages, category and folder template tags are interchangeable. Using <mt:Folders> is the same as using <mt:Categories class_type="folder">.

exclude_blogs

A comma delimited list of blog ids specifying which blogs to exclude categories from when including categories from all blogs in the installation.

This attribute aggregates categories from all blogs except those with ids specified:

<mt:Categories exclude_blogs="1,12,19,37,112">

Blogs which have been explicitly forbidden their content from being aggregated in the Multiblog blog plugin settings are not included.

Related to blog_ids.

glue

A string used to join the output of the separate iterations of MTCategories. This can be as simple as a comma and space (“, ”) to list out category labels or complex HTML markup to be inserted between the markup generated by MTCategories.

include_blogs

Alias of blog_ids. Related to exclude_blogs.

lastn

Limits output to the first N categories. N is a positive integer.

show_empty

Setting this optional attribute to true (1) will include categories with no entries assigned. The default is false (0), where only categories with entries assigned.

Examples

List out the categories used on at least one blog entry, separated by commas:

Categories: <mt:Categories glue=", "><$mt:CategoryLabel$></mt:Categories>

List all categories and link to categories it the category has one or more entries:

<mt:Categories show_empty="1">
    <mt:If name="__first__">
<ul>
    </mt:If>
    <mt:If tag="CategoryCount" gte="1">
    <li><a href="<$mt:CategoryArchiveLink$>"><$mt:CategoryLabel$></a></li>
    <mt:Else>
    <li><$mt:CategoryLabel$></li>
    </mt:If>
    <mt:If name="__last__">
</ul>
    </mt:If>
</mt:Categories>

Related

CategoryArchiveLink

Deprecated: Use <$mt:ArchiveLink$>

A link to the archive page of the current category. Should be used in the context of a Category archive template.

Example

In a Category-Monthly archive template, use the following code to create a link the name of the current category to the main category page:

<a href="<$mt:CategoryArchiveLink$>">Main page for <$mt:CategoryName$> category</a>

CategoryBasename

Produces the dirified basename defined for the category in context.

Attributes

default

A value to use in the event that no category is in context.

separator

Valid values are dash “-” (default) and underscore “_”. Specifying an underscore will convert any dashes to underscores. Specifying a dash will convert any underscores to dashes.

Example

If the basename of the category “News & Press” is news_press then this tag will output the dashed version news-press:

<$mt:CategoryBasename separator="-"$>

For an overview of how to use category tags like mt:CategoryBasename, check out Managing Categories in Movable Type.

CategoryCommentCount

Returns the number of comments associated to entries within the category in context.

Example

List of categories with the comment counts:

<ul>
<mt:Categories>
    <mt:If tag="CategoryCommentCount">
    <li>
        <a href="<$mt:ArchiveLink type="Category"$>"><$mt:CategoryLabel$></a> (Comments: <$mt:CategoryCommentCount$>)
    </li>
    </mt:If>
</mt:Categories>
</ul>

CategoryCount

The number of published entries for the category in context.

Example

List categories containing entries with a count:

<ul>
<mt:Categories>
    <li>
        <a href="<$mt:ArchiveLink type="Category"$>"><$mt:CategoryLabel$></a> (<$mt:CategoryCount$>)
    </li>
</mt:Categories>
</ul>

CategoryCustomFieldDescription

Deprecated: Same as mt:CustomFieldDescription. See EntryCustomFields for more info.

This will display the description of the current custom field in context.

CategoryCustomFieldName

Deprecated: Same as mt:CustomFieldValue. See EntryCustomFields for more info.

This will display the value of the current custom field in context.

CategoryCustomFields

This container tag iterates, or loops, over the list of custom fields associated with an category.

See mt:EntryCustomFields for more details.

<mt:Categories>
    <mt:CategoryCustomFields>
        <$mt:CustomFieldName$>
    </mt:CategoryCustomFields>
</mt:Categories>

Attributes

exclude

Custom field name of the field you wish to exclude from the loop.

<mt:CategoryCustomFields exclude="Foo Field">
    <$mt:CustomFieldName$>
</mt:CategoryCustomFields>

Examples

See mt:EntryCustomFields for more examples.

Related

CategoryCustomFieldValue

Deprecated: Same as mt:CustomFieldValue. See EntryCustomFields for more info.

This will display the value of the current custom field in context.

CategoryDescription

The description for the category in context.

Example

List categories with descriptions:

<dl>
<mt:Categories>
    <dt>
        <$mt:CategoryLabel$>
    </dt>
    <dd>
        <$mt:CategoryDescription$>
    </dd>
</mt:Categories>
</dl>

CategoryID

The numeric system ID of the category.

Example

List categories with category IDs:

<dl>
<mt:Categories>
    <dt>
        <$mt:CategoryLabel$>
    </dt>
    <dd>
        <$mt:CategoryID$>
    </dd>
</mt:Categories>
</dl>

CategoryIfAllowPings

A conditional tag that displays its contents if pings are enabled for the category in context.

On the Edit Category screen there is a checkbox for “Accept Trackbacks”

Use the mt:Pings loop to list the pings for a category.

Example

Display the count of trackbacks for the category in context and the trackback link:

<mt:CategoryIfAllowPings>
  <!-- do something -->
  <$mt:CategoryTrackbackCount$>
  <$mt:CategoryTrackbackLink$>
</mt:CategoryIfAllowPings>

CategoryLabel

The label of the category in context. The current category in context can be placed there by either the following contexts (in order of precedence):

  • the current category you might be by looping through a list of mt:Categories
  • the current category archive template/mapping you are in
  • the primary category of the current entry in context

Example

List all Category Labels linked their respective category archives:

<ul>
<mt:Categories>
    <li>
        <a href="<$mt:ArchiveLink type="Category"$>"><$mt:CategoryLabel$></a>
    </li>
</mt:Categories>
</ul>

Tip: Due to legacy taging the mt:EntryCategory function tag will output the same value as the mt:FolderLabel function tag when used in the context of a page. Unlike the mt:PageFolder tag which is block tag and must be used with the mt:FolderLabel tag.

Use this mtml

 <mt:If tag="EntryCategory" eq="Appendix: Configuration Directives">
     This main folder for this page is "Appendix: Configuration Directives".
     Confirmation using `mt:EntryCategory`: "<$mt:EntryCategory$>".
 </mt:If>

CategoryNext

A container tag which creates a category context of the next category relative to the current entry category or archived category.

<mt:CategoryNext>
    <a href="<MTArchiveLink archive_type="Category">"><MTCategoryLabel></a>
</mt:CategoryNext>

If the current category has sub-categories, then CategoryNext will generate a link to the next sibling category. For example, in the following category hierarchy:

  • News
    • Gossip
    • Politics
    • Sports
  • Events
    • Oakland
    • Palo Alto
    • San Francisco
  • Sports
    • Local College
    • MBA
    • NFL

If the current category is “News” then CategoryNext will link to “Events”.

If the current category is “Palo Alto” then CategoryNext will link to “San Francisco”.

If the current category is “Sports” then CategoryNext will be empty as there is no next category. A link to the next category is not availble for the last category in a list and a link to previous category is not available for the first category.

Here’s an example showing the relationships between categories when determining mt:CategoryNext and mt:CategoryPrevious.

  • Cat 1 (CategoryNext: Cat 2)
    • Cat 1A (CategoryNext: Cat 1B)
    • Cat 1B (CategoryNext: Cat 1C, CategoryPrev: Cat 1A)
    • Cat 1C (CategoryPrev: Cat 1B)
  • Cat 2 (CategoryNext: Cat 3, CategoryPrev: Cat 1)
    • Cat 2A (CategoryNext: Cat 2B)
    • Cat 2B (CategoryNext: Cat 2C, CategoryPrev: Cat 2A)
    • Cat 2C (CategoryPrev: Cat 2B)
  • Cat 3 (CategoryPrev: Cat 2)

Attributes

show_empty

Specifies whether categories with no entries assigned should be counted and displayed.

Examples

List the previous and next for a recursive category list, showing empty categories too:

<mt:SubCategories top="1">
    <mt:SubCatIsFirst>
        <ul>
    </mt:SubCatIsFirst>
            <li>
                <a href="<$mt:CategoryArchiveLink$>" title="<$mt:CategoryDescription$>"><$mt:CategoryLabel$></a>
                <ul>
    <mt:CategoryNext show_empty="1">
                <li>CategoryNext: <a href="<$mt:ArchiveLink archive_type="Category"$>"><$mt:CategoryLabel$></a></li>
    </mt:CategoryNext>
    <mt:CategoryPrevious show_empty="1">
                <li>CategoryPrev: <a href="<$mt:ArchiveLink archive_type="Category"$>"><$mt:CategoryLabel$></a></li>
    </mt:CategoryPrevious>
                </ul>
    <$mt:SubCatsRecurse$>
            </li>
    <mt:SubCatIsLast>
        </ul>
    </mt:SubCatIsLast>
</mt:SubCategories>

CategoryPrevious

A container tag which creates a category context of the previous category relative to the current entry category or archived category.

<mt:CategoryPrevious>
    <a href="<$mt:ArchiveLink archive_type="Category"$>"><$mt:CategoryLabel$></a>
</mt:CategoryPrevious>

If the current category has sub-categories, then CategoryPrevious will generate a link to the previous sibling category.

See mt:CategoryNext for more documentation on this tag.

Attributes

show_empty

Specifies whether categories with no entries assigned should be counted.

Example

See mt:CategoryNext for more examples of mt:CategoryPrevious usage.

CategoryTrackbackCount

The number of published TrackBack pings for the category in context.

Use the mt:Pings loop to list the pings for a category.

Example

Display the count of trackbacks for the category in context and the trackback link:

<mt:CategoryIfAllowPings>
  <!-- do something -->
  <$mt:CategoryTrackbackCount$>
  <$mt:CategoryTrackbackLink$>
</mt:CategoryIfAllowPings>

CategoryTrackbackLink

The URL that TrackBack pings can be sent to for the category in context.

Use the mt:Pings loop to list the pings for a category.

Example

Display the count of trackbacks for the category in context and the trackback link:

<mt:CategoryIfAllowPings>
  <!-- do something -->
  <$mt:CategoryTrackbackCount$>
  <$mt:CategoryTrackbackLink$>
</mt:CategoryIfAllowPings>

CCLicenseRDF

Returns the RDF markup for a Creative Commons License. If the blog has not been assigned a license, this returns an empty string.

Attributes:

  • with_index (optional; default "0")

    If specified, forces the trailing "index" filename to be left on any entry permalink published in the RDF block.

CGIHost

Returns the domain host from the configuration directive CGIPath. If CGIPath is defined as a relative path, then the domain is derived from the Site URL in the blog's "Publishing Settings".

Attributes:

  • exclude_port (optional; default "0")

    If set, exclude the port number from the CGIHost.

CGIPath

The value of the CGIPath configuration setting. Example (the output is guaranteed to end with "/", so appending one prior to a script name is unnecessary):

    <a href="<$mt:CGIPath$>some-cgi-script.cgi">

CGIRelativeURL

The relative URL (path) extracted from the CGIPath setting in mt-config.cgi. This is the same as CGIPath, but without any domain name. This value is guaranteed to end with a "/" character.

CGIServerPath

Returns the file path to the directory where Movable Type has been installed. Any trailing "/" character is removed.

CommentAuthor

Outputs the name field of the current comment in context (for comments left by authenticated users, this will return their display name).

CommentAuthorIdentity

Returns a profile icon link for the current commenter in context. The icon is for the authentication service used (ie, TypeKey, OpenID, Vox LiveJournal, etc.). If the commenter has a URL in their profile the icon is linked to that URL.

CommentAuthorLink

A linked version of the comment author name, using the comment author's URL if provided in the comment posting form. Otherwise, the comment author name is unlinked. This behavior can be altered with optional attributes.

Attributes:

  • show_email (optional; default "0")

    Specifies if the comment author's email can be displayed.

  • show_url (optional; default "1")

    Specifies if the comment author's URL can be displayed.

  • new_window (optional; default "0")

    Specifies to open the link in a new window by adding target="_blank" to the anchor tag. See example below.

  • default_name (optional; default "Anonymous")

    Used in the event that the commenter did not provide a value for their name.

  • no_redirect (optional; default "0")

    Prevents use of the mt-comments.cgi script to handle the comment author link.

  • nofollowfy (optional)

    If assigned, applies a rel="nofollow" link relation to the link.

CommentBlogID

Outputs the numeric ID of the blog for the current comment in context.

CommentBody

Attributes:

  • autolink (optional)

    If unspecified, any plaintext links in the comment body will be automatically linked if the blog is configured to do that on the comment preferences screen. If this attribute is specified, it will override the blog preference.

  • convert_breaks (optional)

    By default, the comment text is formatted according to the comment text formatting choice in the blog preferences. If convert_breaks is disabled, the raw content of the comment body is output without any re-formatting applied.

  • words (optional)

    Limits the length of the comment body to the specified number of words. This is useful for producing a list of recent comments with an excerpt of each.

CommentDate

Outputs the creation date for the current comment in context. See the Date tag for support attributes.

CommentEmail

Publishes the commenter's e-mail address.

NOTE: It is not recommended to publish any email addresses.

Attributes:

  • spam_protect (optional; default "0")

CommentEntry

A block tag that can be used to set the parent entry of the comment in context.

Example:

    <mt:Comments lastn="4">
        <$mt:CommentAuthor$> left a comment on
        <mt:CommentEntry><$mt:EntryTitle$></mt:CommentEntry>.
    </mt:Comments>

CommentEntryID

Outputs the numeric ID for the parent entry (or page) of the current comment in context.

CommenterAuthIconURL

Returns URL to a small (16x16) image represents in what authentication provider the commenter in context is authenticated. Commenter context is created by either a Comments or CommentReplies block tag. For commenters authenticated by Movable Type, it will be a small spanner logo of Movable Type. Otherwise, icon image is provided by each of authentication provider. Movable Type provides images for Vox, LiveJournal and OpenID out of the box.

Example:

    <mt:Comments>
        <$mt:CommenterName$><$mt:CommenterAuthIconURL$>:
        <$mt:CommentBody$>
    </mt:Comments>

CommenterAuthType

Returns a string which identifies what authentication provider the commenter in context used to authenticate him/herself. Commenter context is created by either MTComments or MTCommentReplies template tag. For example, 'MT' will be returned when the commenter in context is authenticated by Movable Type. When the commenter in context is authenticated by Vox, 'Vox' will be returned.

Example:

    <mt:Comments>
      <$mt:CommenterName$> (<$mt:CommenterAuthType$>) said:
      <$mt:CommentBody$>
    </mt:Comments>

CommenterEmail

The email address of the commenter. The spam_protect global filter may be used.

Example:

    <$mt:CommenterEmail$>

CommenterID

Outputs the numeric ID of the current commenter in context.

CommenterIfTrusted

Deprecated in favor of the IfCommenterTrusted tag.

CommenterName

The name of the commenter for the comment currently in context.

Example:

    <$mt:CommenterName$>

CommenterNameThunk

Used to populate the commenter_name Javascript variable. Deprecated in favor of the UserSessionState tag.

CommenterURL

Outputs the URL from the profile of the current commenter in context.

CommenterUsername

This template tag returns the username of the current commenter in context. If no name exists, then it returns an empty string.

Example:

    <mt:Entries>
        <h1><$mt:EntryTitle$></h1>
        <mt:Comments>
            <a name="comment-<$mt:CommentID$>"></a>
            <p><$mt:CommentBody$></p>
            <cite><a href="/profiles/<$mt:CommenterID$>"><$mt:CommenterUsername$></a></cite>
        </mt:Comments>
    </mt:Entries>

CommenterUserpic

This template tag returns a complete HTML img tag for the current commenter's userpic. For example:

    <img src="http://yourblog.com/userpics/1.jpg" width="100" height="100" />

Example:

    <h2>Recent Commenters</h2>
    <mt:Entries recently_commented_on="10">
        <div class="userpic" style="float: left; padding: 5px;"><$mt:CommenterUserpic$></div>
    </mt:Entries>

CommenterUserpicAsset

This template tag is a container tag that puts the current commenter's userpic asset in context. Because userpics are stored as assets within Movable Type, this allows you to utilize all of the asset-related template tags when displaying a user's userpic.

Example:

     <mt:CommenterUserpicAsset>
        <img src="<$mt:AssetThumbnailURL width="20" height="20"$>"
            width="20" height="20"  />
     </mt:CommenterUserpicAsset>

CommenterUserpicURL

This template tag returns the URL to the image of the current commenter's userpic.

Example:

    <img src="<$mt:CommenterUserpicURL$>" />

CommentFields

A deprecated tag that formerly published an entry comment form.

CommentID

Outputs the numeric ID for the current comment in context.

CommentIfModerated

Conditional tag for testing whether the current comment in context is moderated or not (used for application, email and comment response templates where the comment may not actually be published).

CommentIP

Outputs the IP address where the current comment in context was posted from.

CommentLink

Outputs the permalink for the comment currently in context. This is the permalink for the parent entry, plus an anchor for the comment itself (in the format '#comment-ID').

CommentName

Deprecated in favor of the CommentAuthor tag.

CommentOrderNumber

Outputs a number relating to the position of the comment in the list of all comments published using the Comments tag, starting with "1".

CommentParent

A block tag that can be used to set the parent comment of the current comment in context. If the current comment has no parent, it produces nothing.

Example:

    <mt:CommentParent>
        (a reply to <$mt:CommentAuthor$>'s comment)
    </mt:CommentParent>

CommentParentID

Outputs the ID of the parent comment for the comment currently in context. If there is no parent comment, outputs '0'.

Attributes:

  • pad

    If specified, zero-pads the ID to 6 digits. Example: 001234.

CommentPreviewAuthor

A deprecated tag, replaced with CommentAuthor.

CommentPreviewAuthorLink

A deprecated tag, replaced with CommentAuthorLink.

CommentPreviewBody

A deprecated tag, replaced with CommentBody.

CommentPreviewDate

A deprecated tag, replaced with CommentDate.

CommentPreviewEmail

A deprecated tag, replaced with CommentEmail.

CommentPreviewIP

A deprecated tag, replaced with CommentIP.

CommentPreviewIsStatic

For the comment preview template only.

CommentPreviewState

For the comment preview template only.

CommentPreviewURL

A deprecated tag, replaced with CommentURL.

CommentRank

A function tag which returns a number from 1 to 6 (by default) which represents the rating of the comment in context in terms of total score where '1' is used for the highest score, '6' for the lowest score.

Attributes:

  • namespace (required)

    Specify namespace for rank to be calculated. Namespace is defined by each plugin which leverages rating API.

  • max (optional; default "6")

    Allows a user to specify the upper bound of the scale.

Example:

    <$mt:CommentRank namespace="FiveStarRating"$>

CommentReplies

A block tag which iterates over a list of reply comments to the in context.

Example:

    <mt:Comment>
      <mt:CommentReplies>
        <mt:CommentsHeader>Replies to the comment:</mt:CommentsHeader>
        <$mt:CommentBody$>
      </mt:CommentReplies>
    </mt:Comment>

CommentRepliesRecurse

Recursively call the block with the replies to the comment in context. This tag, when placed at the end of loop controlled by MTCommentReplies tag will cause them to recursively descend into any replies to comments that exist during the loop.

Example:

    <mt:Comments>
      <$mt:CommentBody$>
      <mt:CommentReplies>
        <mt:CommentsHeader><ul></MTCommentsHeader>
        <li><$mt:CommentID$>
        <$mt:CommentRepliesRecurse$>
        </li>
        <mt:CommentsFooter></ul></mt:CommentsFooter>
      </mt:CommentReplies>
    </mt:Comments>

CommentReplyToLink

Produces the "Reply" link for the current comment in context. By default, this relies on using the MT "Javascript" default template, which supplies the mtReplyCommentOnClick function.

Attributes:

  • label or text (optional)

    A custom phrase for the link (default is "Reply").

  • onclick (optional)

    Custom JavaScript code for the onclick attribute. By default, this value is "mtReplyCommentOnClick(%d, '%s')" (note that %d is replaced with the comment ID; %s is replaced with the name of the commenter).

Comments

A container tag which iterates over a list of comments on an entry or for a blog. By default, all comments in context (meaning all the comments for that particular entry or in a blog) are returned. If you use it in a blog context, only comments on published entries are returned.

You can view a list of all comment-related template tags for an idea of the flexibility available in publishing comments. And the following attributes will let you custom-tailor the mt:Comments tag to show exactly the the comments you are selecting.

Attributes:

  • lastn

    Display the last N comments in context where N is a positive integer. NOTE: lastn is required in a blog context.

  • offset (optional; default "0")

    Specifies a number of comments to skip.

  • sort_by (optional)

    Specifies a sort column.

  • sort_order (optional)

    Specifies the sort order and overrides the General Settings. Recognized values are "ascend" and "descend."

  • namespace

    Used in conjunction with the "min*", "max*" attributes to select comments based on a particular scoring mechanism.

  • min_score

    If 'namespace' is also specified, filters the comments based on the score within that namespace. This specifies the minimum score to consider the comment for inclusion.

  • max_score

    If 'namespace' is also specified, filters the comments based on the score within that namespace. This specifies the maximum score to consider the comment for inclusion.

  • min_rank

    If 'namespace' is also specified, filters the comments based on the rank within that namespace. This specifies the minimum rank to consider the comment for inclusion.

  • max_rate

    If 'namespace' is also specified, filters the comments based on the rank within that namespace. This specifies the maximum rank to consider the comment for inclusion.

  • min_count

    If 'namespace' is also specified, filters the comments based on the count within that namespace. This specifies the minimum count to consider the comment for inclusion.

  • max_count

    If 'namespace' is also specified, filters the comments based on the count within that namespace. This specifies the maximum count to consider the comment for inclusion.

CommentScore

A function tag that provides total score of the comment in context. Scores grouped by namespace of a plugin are summed to calculate total score of a comment.

Attributes:

  • namespace (required)

    Specify namespace for score to be calculated. Namespace is defined by each plugin which leverages rating API.

Example:

    <$mt:CommentScore namespace="FiveStarRating"$>

CommentScoreAvg

A function tag that provides the avarage score of the comment in context. Scores grouped by namespace of a plugin are summed to calculate total score of a comment, and average is calculated by dividing the total score by the number of scorings or 'votes'.

Attributes:

  • namespace (required)

    Specify namespace for avarage score to be calculated. Namespace is defined by each plugin which leverages rating API.

Example:

    <$mt:CommentScoreAvg namespace="FiveStarRating"$>

CommentScoreCount

A function tag that provides the number of scorings or 'votes' made to the comment in context. Scorings grouped by namespace of a plugin are summed.

Attributes:

  • namespace (required)

    Specify namespace for the number of scorings to be calculated. Namespace is defined by each plugin which leverages rating API.

Example:

    <$mt:CommentScoreCount namespace="FiveStarRating"$>

CommentScoreHigh

A function tag that provides the highest score of the comment in context. Scorings grouped by namespace of a plugin are sorted to find the highest score of a comment.

Attributes:

  • namespace (required)

    Specify namespace for the score to be sorted. Namespace is defined by each plugin which leverages rating API.

Example:

    <$mt:CommentScoreHigh namespace="FiveStarRating"$>

CommentScoreLow

A function tag that provides the lowest score of the comment in context. Scorings grouped by namespace of a plugin are sorted to find the lowest score of a comment.

Attributes:

  • namespace (required)

    Specify namespace for the score to be sorted. Namespace is defined by each plugin which leverages rating API.

Example:

    <$mt:CommentScoreLow namespace="FiveStarRating"$>

CommentScript

Returns the value of the CommentScript configuration setting. The default for this setting if unassigned is "mt-comments.cgi".

CommentsFooter

The contents of this container tag will be displayed when the last comment listed by a Comments or CommentReplies tag is reached.

CommentsHeader

The contents of this container tag will be displayed when the first comment listed by a Comments or CommentReplies tag is reached.

CommentURL

Outputs the URL of the current comment in context. The URL is the link provided in the comment from an anonymous comment, or for authenticated comments, is the URL from the commenter's profile.

ConfigFile

Returns the full file path for the Movable Type configuration file (mt-config.cgi).

CurrentPage

A function tag returns a number represents the number of current page. The number starts from 1.

CustomFieldBasename

Returns the basename entered when custom field was created for the object in context.

<$mt:CustomFieldBasename$>

The value must be unique among all other custom field basenames.

See mt:EntryCustomFields for more documentation.

Related

CustomFieldDescription

Returns the description entered when custom field was created for the object in context.

<$mt:CustomFieldDescription$>

See mt:EntryCustomFields for more documentation.

Related

CustomFieldName

Returns the name or "label" entered when custom field was created for the object in context.

<$mt:CustomFieldName$>

See mt:EntryCustomFields for more documentation.

Related

CustomFieldValue

Returns the value selected or data entered on the "Edit" screen for the object in context.

<$mt:CustomFieldValue$>

See mt:EntryCustomFields for more documentation.

Related

D

Date

Outputs the current date.

Attributes:

  • ts (optional)

    If specified, will use the given date as the date to publish. Must be in the format of "YYYYMMDDhhmmss".

  • relative (optional)

    If specified, will publish the date using a phrase, if the date is less than a week from the current date. Accepted values are "1", "2", "3" and "js". The options for "1", "2" and "3" affect the style of the phrase.

    • relative="1"

      Supports display of one duration: moments ago; N minutes ago; N hours ago; N days ago. For older dates in the same year, the date is shown as the abbreviated month and day of the month ("Jan 3"). For older dates, the year is added to that ("Jan 3 2005").

    • relative="2"

      Supports display of two durations: less than 1 minute ago; N seconds, N minutes ago; N minutes ago; N hours, N minutes ago; N hours ago; N days, N hours ago; N days ago.

    • relative="3"

      Supports display of two durations: N seconds ago; N seconds, N minutes ago; N minutes ago; N hours, N minutes ago; N hours ago; N days, N hours ago; N days ago.

    • relative="js"

      When specified, publishes the date using JavaScript, which relies on a MT JavaScript function 'mtRelativeDate' to format the date.

  • format (optional)

    A string that provides the format in which to publish the date. If unspecified, the default that is appropriate for the language of the blog is used (for English, this is "%B %e, %Y %l:%M %p"). The format specifiers supported are:

    • %Y

      The 4-digit year. Example: "1999".

    • %m

      The 2-digit month (zero-padded). Example: for a date in September, this would output "09".

    • %d

      The 2-digit day of the month (zero-padded). Example: "05".

    • %H

      The 2-digit hour of the day (24-hour clock, zero-padded). Example: "18".

    • %M

      The 2-digit minute of the hour (zero-padded). Example: "09".

    • %S

      The 2-digit second of the minute (zero-padded). Example: "04".

    • %w

      The numeric day of the week, in the range 0-6, where 0 is Sunday. Example: "3".

    • %j

      The numeric day of the year, in the range 001-365. Zero-padded to three digits. Example: "040".

    • %y

      The two-digit year, zero-padded. Example: %y for a date in 2008 would output "08".

    • %b

      The abbreviated month name. Example: %b for a date in January would output "Jan".

    • %B

      The full month name. Example: "January".

    • %a

      The abbreviated day of the week. Example: %a for a date on a Monday would output "Mon".

    • %A

      The full day of the week. Example: "Friday".

    • %e

      The numeric day of the month (space-padded). Example: " 8".

    • %I

      The two-digit hour on a 12-hour clock padded with a zero if applicable. Example: "04".

    • %k

      The two-digit military time hour padded with a space if applicable. Example: " 9".

    • %l

      The hour on a 12-hour clock padded with a space if applicable. Example: " 4".

  • format_name (optional)

    Supports date formatting for particular standards.

    • rfc822

      Outputs the date in the format: "%a, %d %b %Y %H:%M:%S Z".

    • iso8601

      Outputs the date in the format: "%Y-%m-%dT%H:%M:%SZ".

  • utc (optional)

    Converts the date into UTC time.

  • offset_blog_id (optional)

    Identifies the ID of the blog to use for adjusting the time to blog time. Will default to the current blog in context if unset.

  • language (optional)

    Used to force localization of the date to a specific language. Accepted values: "cz" (Czechoslovakian), "dk" (Scandinavian), "nl" (Dutch), "en" (English), "fr" (French), "de" (German), "is" (Icelandic), "ja" (Japanese), "it" (Italian), "no" (Norwegian), "pl" (Polish), "pt" (Portuguese), "si" (Slovenian), "es" (Spanish), "fi" (Finnish), "se" (Swedish). Will use the blog's date language setting as a default.


Examples

  • Format YYYY-MM-DD (2009-05-22)

    <$mt:Date format="%Y-%m-%d"$>
  • Format Month DD, YYY (Friday, May 22, 2009)

    <$mt:Date format="%A, %b %e, %Y"$>

DateFooter

A container tag whose contents will be displayed if the entry in context is the last entry in the group of entries for a given day.

Example:

    <mt:Entries>
        <!-- display entry here -->
        <mt:DateFooter>
            <hr />
        </mt:DateFooter>
    </mt:Entries>

DateHeader

A container tag whose contents will be displayed if the entry in context was posted on a new day in the list.

Example:

    <mt:Entries>
        <mt:DateHeader>
            <h2><$mt:EntryDate format="%A, %B %e, %Y"$></h2>
        </mt:DateHeader>
        <!-- display entry here -->
    </mt:Entries>

DefaultLanguage

The value of the DefaultLanguage configuration setting.

Example:

    <$mt:DefaultLanguage$>

This outputs a language code, ie: "en_US", "ja", "de", "es", "fr", "nl" or other installed language.

E

Else

A container tag used within If and Unless blocks to output the alternate case.

This tag supports all of the attributes and logical operators available in the If tag and can be used multiple times to test for different scenarios.

Example:

    <mt:If name="some_variable">
        'some_variable' is assigned
    <mt:Else name="some_other_variable">
        'some_other_variable' is assigned
    <mt:Else>
        'some_variable' nor 'some_other_variable' is assigned
    </mt:If>

ElseIf

An alias for the 'Else' tag.

Entries

A block tag which iterates over a list of published entries from a blog and outputs a selection of entries that are appropriate for the context used and the template being published.

The <mt:Entries> tag is one of the most basic tags you’ll use in working with Movable Type. Put simply, you open and close the <mt:Entries> and </mt:Entries> tags, and in between, Movable Type will loop through all of your entries, displaying the information you’ve chosen in the format you desire.

<mt:Entries>
    <$mt:EntryTitle$>
    <$mt:EntryBody$>
</mt:Entries>

Nearly every template uses <mt:Entries> in one way or another because this tag is so powerful. You can add in attributes to specify exactly which entries to show on your page. Attributes can be used in combination to sort, select, and filter entries exactly as desired. Be sure to check out the examples.

The default behavior is set according to the “Entry Listing Default” and “Entry Order” preferences in the Entry Settings. The attributes days, lastn, and sort_order attributes override their corresponding settings in the blog’s General settings menu.

Used without any attributes, <mt:Entries> will output entries based upon the context in which it is used:

  • Index Template: recent entries as specified by the “Entry Listing Default” preference in the Entry Settings
  • Archive Templates: all the entries in context of the template’s archive mapping:
    • monthly: all entries for the month in context
    • category: recent entries in a category
    • author: recent entries by a particular author
    • category-monthly: all entries in a category published in the same month

Note: author and category archive mappings are limited to the value set for “Entry Listing Default” preference in the Entry Settings. Without this default, these archives could take progressively longer and longer to publish. You can override this default with the lastn attribute.

The <mt:Entries> tag can be placed in custom modules, index templates and widgets to select content in many different ways.

The output <mt:Entries> can be affected by mt:Entry tag attributes and template tag modifiers.

Beware that the ordered combination of attribtutes and modifiers can effect the output of mt:Entries.

Attributes

All <mt:Entries> attributes are optional. The most common attributes are:

author

Accepts an author’s username to filter entry selection. (The username is the one you log in with, not the fancy Display Name if you’ve set that in your profile.)

<mt:Entries author="melody">

Tip: To dynamically apply the author username use variable interpolation with the mt:EntryAuthorUsername tag (when in entry context):

<$mt:EntryAuthorUsername setvar="entry_author_username"$>
<mt:Entries author="$entry_author_username">
    <li><a href="<$mt:EntryPermalink$>"><$mt:EntryTitle$></a></li>
</mt:Entries>

blog_ids

A comma delimited list of blog ids specifying which blogs to include entries from, or the word “all” to include entries from all blogs in the intallation.

This attribute aggregates entries from multiple blogs:

<mt:Entries blog_ids="1,12,19,37,112">

A value of “all” expands the context to all blogs (in the installation) except those blogs which have been explicitly forbidden their content from being aggregated in the Multiblog blog plugin settings.

<mt:Entries blog_ids="all">

Alias of include_blogs.

category

This attribute allows you to filter the entries based on category assignment. The simple case is to filter for a single category, where the full category name is specified:

<mt:Entries category="Featured">

Multiple categories with the same name can be differentiated using their parent category names to be more explicit:

<mt:Entries category="News/Featured">

or

<mt:Entries category="Projects/Featured">

Advanced boolean logic is supported in category and tag attributes (AND, OR, NOT, parenthetical grouping) to include or exclude categories:

<mt:Entries category="(Family OR Pets) AND Featured">

or

<mt:Entries category="((Cats AND Dogs) OR General) AND NOT Private">

or

<mt:Entries category="NOT Family">

Category ID is also a valid value when preceded by a pound (“#”) sign.

<mt:Entries category="#33">

or

<mt:Entries category="((#31 AND #32) OR General) AND NOT #3">

categories

Alias of category.

days

Filters all posts less than N days old (the date when the page is published). N is a positive integer.

The days attribute should be used separately from other attributes. If used with another attribute, days is ignored.

To display all entries with a publish date in the last 10 days, use this:

<mt:Entries days="10">

Set a number of days to be the default behavior for the <mt:Entries> tag in the “Entry Listing Default” preference in the Entry Settings

exclude_blogs

A comma delimited list of blog ids specifying which blogs to exclude entries from when including entries from all blogs in the intallation.

This attribute aggregates entries from all blogs except those with ids specified:

<mt:Entries exclude_blogs="1,12,19,37,112">

Blogs which have been explicitly forbidden their content from being aggregated in the Multiblog blog plugin settings are not included.

Related to blog_ids.

field:basename

Permits filtering entries based on a custom field defined (custom fields are part of the Commercial Pack in MT 4.0 and 4.1, and are built in to MT Pro from version 4.2 on.).

Select the last 5 entries that have a checkbox custom field with a basename of “subscribe” which is checked:

<mt:Entries field:subscribe="1" sort_by="authored_on" sort_order="descend" limit="5">

glue

A string that is output between published entries. Use it to comma-separate items, to add spaces or tabs, or to do even more complicated things.

Output a comma-separated list of entry ids (i.e. 3,2,1):

<mt:Entries glue=","><$mt:EntryID$></mt:Entries>

id

Outputs a single entry matching the given entry ID.

<mt:Entries id="33">

include_blogs

Alias of blog_ids. Related to exclude_blogs.

include_subcategories

Boolean value, 1 or 0 (default). If specified in conjunction with the category (or categories) attribute, entries assigned to subcategories of the identified category/categories will be included.

lastn

Display the last N posts of the blog. N is a positive integer.

This attribute implies selection of entries based on their “authored” date (“Published Date” in the app), in reverse chronological order.

Movable Type will follow the value for “Entry Listing Default” preference in the Entry Settings if this attribute is not provided.

A value of “0” (zero) will output all entries.

Publish the 5 most recent entries, ordered by their title:

<mt:Entries lastn="5" sort_by="title" sort_order="ascend">

Note: when sorting use the limit attribute; when using lastn it is assumed that recent entries are desired.

limit

Used in Entry Listing archive templates or when sorting by a value other than by publish date. Can be a positive integer or “auto”, which defaults to the “Entry Listing Default” preference in the Entry Settings. Similar to the lastn attribute.

max_score

Returns entries with a score lower than the max_score value for the given namespace (required).

min_score

Returns entries with a score higher than the min_score value for the given namespace (required).

max_rate

Returns entries with a rate with the highest average score for the given namespace (required).

min_rate

Returns entries with the lowest average score for the given namespace (required).

max_count

Returns entries with which have been scored the most number of times (with any score) for the given namespace (required).

min_count

Returns entries with which have been scored the least number of times (with any score) for the given namespace (required).

namespace

Used to specify which scoring framework namespace to use when sorting by score (sort_by=”score”) or filtering based by score (max_score, min_score, max_rate, min_rate, max_count, min_count).

The MT Community Pack provides a community_pack_recommend namespace, for instance, which can be used to select entries, sorting by number of “recommend” or “favorite” scores that have been submitted.

offset

Used in coordination with lastn, starts N entries from the start of the list.

N is a positive integer or the keyword “auto” (if dynamic publishing has been enabled) to automatically determine the offset based on the offset query parameter for the request.

This code will place the first three entries in heading 2 tags and then place the rest in an unordered list:

<mt:Entries lastn="3">
<h2><$mt:EntryTitle$></h2>
</mt:Entries>
<ul>
<mt:Entries offset="3">
    <li><$mt:EntryTitle$></li>
</mt:Entries>
<ul>

recently_commented_on

Display the N most recently commented-on entries. Each entry will appear in the list only once. N is a positive integer.

<mt:Entries recently_commented_on="10">

Entries are in descending order by comment date.

sort_by

Defines the data to sort entries. The default value is “authored_on”. Accepted values are:

  • authored_on - (default) date/time when the entry was published. Editable through the MT user interface.
  • author_id
  • comment_count
  • created_on - date/time when the entry was created. Not editable via MT user interface.
  • excerpt
  • field:BASENAME where BASENAME is the basename of a custom field

    Warning: There is a bug 98025 with this attribute as of MT4.261 that causes the mt:Entries loop to lose blog context when using the field:basename in archive entry listing templates. This issue does not exist in index templates.

    Workarounds have been found by using another attribute to set context:

    Using the include_blogs attribute:

    <$mt:blogid setvar="blog_id"$>
    <MTEntries sort_by="field:your_custom_field" include_blogs="$blog_id">
        ...
    </MTEntries>
    

    or in a Category Entry Listing archive using the category attribute:

    <$mt:ArchiveTitle setvar="category_label"$>
    <MTEntries category="$category_label" sort_by="field:your_custom_field">
        ...
    </MTEntries>
    
  • modified_on - date/time when the entry was last modified. Not editable via MT user interface.
  • ping_count or trackback_count
  • rate (requires use of namespace attribute)
  • score (requires use of namespace attribute)
  • status
  • title

Use the limit attribute when sorting as lastn assumes that recent entries are desired.

scored_by

Allows filtering of entries that were scored by a particular user, specified by username. Requires the namespace attribute.

sort_order

Accepted values are “ascend” and “descend”. Default order is the order specified for “Entry Order” in the Entry Settings. Use the limit attribute when sorting as lastn assumes that recent entries are desired.

<mt:Entries sort_order="descend">

tag

Filters entries by specified tag; published and private tags are supported values. The boolean operators (AND, OR, NOT, parenthetical grouping) described for category selection are also supported for the tag attribute.

Output all entries tagged with “cats”:

<mt:Entries tag="cats">

Output the opposite (all entries that are not tagged “cats”):

<mt:Entries tag="NOT cats">

Output all entries tagged “cats” and tagged “dogs”:

<mt:Entries tag="cats AND dogs">

Output all entries tagged “cats” but not tagged “dogs”::

<mt:Entries tag="cats AND NOT dogs">

tags

Alias of tag attribute.

unique

Filters out entries that have been previously published on the same page using another <mt:entries> tag. Values 1 or 0 (default).

The second Entries tag will exclude any entries that are output from the first Entries tag:

<mt:Entries tag="@featured" lastn="3">
    <$mt:EntryTitle$>
</mt:Entries>
<mt:Entries lastn="7" unique="1">
    <$mt:EntryTitle$>
</mt:Entries>

Combination of Attributes and Modifiers

Attributes can be combined to display entries such as the most recent entry in the “Important” category:

<mt:Entries lastn="1" category="Important">

Repeated modifiers are all processed:

<mt:Entries regex_replace="regex1" regex_replace="regex2">

Order of attributes and modifiers is important.

Trim to ten characters and then limit to the last 10 words:

<mt:Entries trim_to="10" words="10">

Limit to the last 10 words and then trim to 10 characters:

<mt:Entries words="10" trim_to="10">

Examples

Most Recent Entries

This code is typically use in an index template:

<ul>
<mt:Entries lastn="10">
    <li><a href="<$mt:EntryPermalink$>"><$mt:EntryTitle$></a></li>
<mt:Entries>
</ul>

Recently Modified Entries

The 25 most recently modified entries (most recent on top) in an index template:

<ul>
<mt:Entries sort_by="modified_on" sort_order="descend" limit="25">
    <li><$mt:EntryModifiedDate format="%Y-%m-%d"$> - <a href="<$mt:EntryPermalink$>"><$mt:EntryTitle$></a></li>
</mt:Entries>
</ul>

Complex Example

In the default templates for MT4, there are some tricky conditional items used within <mt:Entries>. A simplified version of the default loop looks like this:

<MTEntries>
<$MTEntryTrackbackData$>
<div id="entry-<$MTEntryID$>">
    <h2 class="asset-name"><a href="<$MTEntryPermalink$>"><$MTEntryTitle$></a></h2>
    By <$MTEntryAuthorLink show_email="0"$> on <$MTEntryDate format="%x %X"$> |
    <a class="permalink" href="<$MTEntryPermalink$>">Permalink</a> | 
    <a href="<$MTEntryPermalink$>#comments">Comments (<$MTEntryCommentCount$>)</a> |
    <a href="<$MTEntryPermalink$>#trackback">TrackBacks (<$MTEntryTrackbackCount$>)</a>
    <$MTEntryBody$>
    <div class="entry-tags">
        <h4>Tags:</h4>
        <ul class="entry-tags-list">
            <li class="entry-tag">
            <MTEntryTags glue=",</li> <li>">
                <a href="<$MTTagSearchLink$>&IncludeBlogs=<$MTBlogID$>" rel="tag"><$MTTagName$></a>
            </MTEntryTags>
            </li>
        </ul>
    </div>
    Continue reading <a href="<$MTEntryPermalink$>#more"><$MTEntryTitle$></a>.
</div>
</MTEntries>

Related Entries by Category

Display entries which are in the same category as the current entry:

<$MTEntryCategory setvar="entry_category"$>
<MTEntries category="$entry_category" glue=", ">
    <a href="<$mt:EntryPermalink$>"><$mt:EntryTitle$></a>
</MTEntries>

Related Entries by Tag

Display entries which have the same tags as the current entry:

<mt:EntryIfTagged>
    <$mt:EntryID setvar="entry_id"$>
    <mt:SetVarBlock name="entry_tags"><mt:EntryTags glue=" OR "><$mt:TagName$></mt:EntryTags></mt:SetVarBlock>
    <mt:SetVarBlock name="related_entries">
        <mt:Entries tags="$entry_tags">
            <mt:SetVarBlock name="related_entry_id"><$mt:EntryID$></mt:SetVarBlock>
            <mt:Unless name="related_entry_id" eq="$entry_id">
                <li><a href="<$mt:EntryPermalink$>"><$mt:EntryTitle$></a></li>
            </mt:Unless>
        </mt:Entries>
    </mt:SetVarBlock>
    <mt:If name="related_entries">
        <h2>Related Entries</h2>
        <ul>
            <$mt:Var name="related_entries"$>
        </ul>
    </mt:If>
</mt:EntryIfTagged>

Related

EntriesCount

Returns the count of a list of entries that are currently in context (ie: used in an archive template, or inside an Entries tag). If no entry list context exists, it will fallback to the list that would be selected for a generic Entries tag (respecting number of days or entries configured to publish on the blog's main index template).

EntriesFooter

The contents of this container tag will be displayed when the last entry listed by a Entries tag is reached.

EntriesHeader

The contents of this container tag will be displayed when the first entry listed by a Entries tag is reached.

EntriesWithSubCategories

A specialized version of mt:Entries that is aware of subcategories. The difference between the two tags is the behavior of the category attribute.

<mt:EntriesWithSubCategories>
  <!-- do something -->
</mt:EntriesWithSubCategories>

Attributes

category

The value of this attribute is a category label. This will include any entries to that category and any of its subcategories.

Since it is possible for two categories to have the same label, you can specify one particular category by including its ancestors, separated by slashes.

For instance if you have a category “Flies” and within it a subcategory labeled “Fruit”, you can ask for that category with category=”Flies/Fruit”. This would distinguish it from a category labeled “Fruit” within another called “Food Groups”, for example, which could be identified using category=”Food Groups/Fruit”.

If any category in the ancestor chain has a slash in its label, the label must be quoted using square brackets: category=”Beverages/[Coffee/Tea]” identifies a category labeled Coffee/Tea within a category labeled Beverages.

mt:Entries attributes

You can also use any of the other attributes available to mt:Entries; and they should behave just as they do with the original tag.

Examples

Because this tag is essentially a pre-filtered version of mt:Entries, please see mt:Entries for more examples.

EntryAdditionalCategories

This loop tag iterates over all secondary categories for the entry in context. This tag be used in an entry context (entry archive or mt:Entries loop).

<mt:EntryAdditionalCategories>
    <!-- do something -->
</mt:EntryAdditionalCategories>

This tag is similar to the mt:EntryCategories loop tag, but filters out the entry’s primary category.

Return the entry’s primary category using mt:EntryCategory.

Examples

List and link to an entry’s non-primary categories:

<mt:EntryAdditionalCategories show_empty="1">
    <mt:If name="__first__">
        <ul>
    </mt:If>
            <li>
                <a href="<$mt:CategoryArchiveLink$>"><$mt:CategoryLabel$></a>
            </li>
    <mt:If name="__last__">
        </ul>
    </mt:If>
</mt:EntryAdditionalCategories>

EntryAssets

A container tag which iterates over a list of assets for the current entry in context. Supports all the attributes provided by the Assets tag.

EntryAtomID

Outputs the unique Atom ID for the current entry in context.

EntryAudio

This template tag outputs a link to the audio portion of an Audio post.

This template tag is related to the custom fields that are automatically generated when you use Motion template sets. It can only be used with blogs created with Motion template sets.



Example:
<mt:Entries>
<mt:EntriesHeader>
<ul>
</mt:EntriesHeader>
<$mt:EntryPostType setvar="post_type"$>
<li>
<mt:If name="entry_type" eq="photo">
<$mt:EntryPhoto$>
</mt:If>
<mt:If name="entry_type" eq="link">
<$mt:EntryLinkURL$>
</mt:If>
<mt:If name="entry_type" eq="embed">
<$mt:EntryEmbedCode$>
</mt:If>
<mt:If name="entry_type" eq="audio">
<$mt:EntryAudio$>
</mt:If>
</li>
<mt:EntriesFooter>
</ul>
</mt:EntriesFooter>

</mt:Entries>

EntryAuthor

Deprecated:This tag is considered deprecated in favor of EntryAuthorDisplayName. It is not recommended to publish MT usernames.

Outputs the display name of the author for the current entry in context.

EntryAuthorDisplayName

Outputs the display name of the author for the current entry in context.

<$mt:EntryAuthorDisplayName$>

If the author has not provided a display name for publishing, this tag will output an empty string.

EntryAuthorEmail

Outputs the email address of the author for the current entry in context. NOTE: it is not recommended to publish e-mail addresses for MT users.

Attributes:

  • spam_protect (optional; default "0")

    If specified, this will apply a light obfuscation of the email address, by encoding any characters that will identify it as an email address (:, @, and .) into HTML entities.

EntryAuthorID

Outputs the numeric ID of the author for the current entry in context.

EntryAuthorLink

Outputs a linked author name suitable for publishing in the 'byline' of an entry.

Attributes:

  • new_window

    If specified, the published link is given a target attribute of '_blank'.

  • show_email (optional; default "0")

    If set, will allow publishing of an email address if the URL field for the author is empty.

  • spam_protect (optional)

    If specified, this will apply a light obfuscation of any email address published, by encoding any characters that will identify it as an email address (:, @, and .) into HTML entities.

  • type (optional)

    Accepted values: url, email, archive. Note: an 'archive' type requires publishing of "Author" archives.

  • show_hcard (optional; default "0")

    If present, adds additional CSS class names to the link tag published, identifying the link as a url or email address depending on the type of link published.

EntryAuthorNickname

An alias of EntryAuthorDisplayName. This tag is deprecated in favor of EntryAuthorDisplayName.

EntryAuthorURL

Outputs the Website URL field from the author's profile for the current entry in context.

EntryAuthorUsername

Outputs the username of the author for the entry currently in context. NOTE: it is not recommended to publish MT usernames.

EntryAuthorUserpic

Outputs the HTML for the userpic of the author for the current entry in context.

EntryAuthorUserpicAsset

A block tag providing an asset context for the userpic of the author for the current entry in context. See the Assets tag for more information about publishing assets.

EntryAuthorUserpicURL

Outputs the URL for the userpic image of the author for the current entry in context.

EntryBasename

Outputs the basename field for the current entry in context.

Attributes:

  • separator (optional)

    Accepts either "-" or "_". If unspecified, the raw basename value is returned.

EntryBlogDescription

Returns the blog description of the blog to which the entry in context belongs. The blog description is set in the General Blog Settings.

Example:

    <$mt:EntryBlogDescription$>

EntryBlogID

The numeric system ID of the blog that is parent to the entry currently in context.

Example:

    <$mt:EntryBlogID$>

EntryBlogName

Returns the blog name of the blog to which the entry in context belongs. The blog name is set in the General Blog Settings.

Example:

    <$mt:EntryBlogName$>

EntryBlogURL

Returns the blog URL for the blog to which the entry in context belongs.

Example:

    <$mt:EntryBlogURL$>

EntryBody

Outputs the "main" text of the current entry in context.

Attributes:

  • convert_breaks (optional; default "1")

    Accepted values are '0' and '1'. Typically, this attribute is used to disable (with a value of '0') the processing of the entry text based on the text formatting option for the entry.

  • words (optional)

    Accepts any positive integer to limit the number of words that are output.


EntryBody supports a whole bunch of additional attributes to help format the output of the tag. Using those attributes, you can transform the content so it shows up correctly in HTML, JavaScript, PHP, XML or other forms of output, use regular expressions to modify the output of this tag, change the case of characters, add or remove white space or even more with just a simple attribute on the mt:EntryBody tag.

In the past, mt:EntryBody has been known as MTEntryBody, too. If you're using the Extended Entry field in Movable Type, it works similarly to mt:EntryBody but with the mt:EntryMore tag.

EntryCategories

A container tag that lists all of the categories (primary and secondary) to which the entry is assigned.

This tagset creates a category context within which any category or subcategory tags may be used.

<mt:EntryCategories>
    <!-- do something -->
</mt:EntryCategories>

Attributes

glue

If specified, this string is placed in between each result from the loop.

Examples

List and link all entry categories:

<mt:Entries>
    <MTEntryCategories glue=", "><a href="<$mt:ArchiveLink type="Category"$>"><$mt:CategoryLabel$></a></MTEntryCategories>
</mt:Entries>

If entry primary category label matches the label of the category in the loop, then make it bold:

<mt:Entries>
    <$mt:EntryCategory setvar="entry_category"$>
    <ul>
    <MTEntryCategories>
        <li><a href="<$mt:ArchiveLink type="Category"$>"><mt:If tag="CategoryLabel" eq="$entry_category"><strong><$mt:CategoryLabel$></strong><mt:Else><$mt:CategoryLabel$></mt:If></a></li>
    </MTEntryCategories>
    </ul>
    <$mt:Var name="entry_category" value=""$>
</mt:Entries>

If entry category is in set (Explore, Savor, Inside, Offbeat, Celebrate), add category basename as a class and link to category archive.

<mt:Entries>
    <mt:EntryCategories>
        <mt:If tag="CategoryLabel" like="(Explore|Savor|Inside|Offbeat|Celebrate)">
            <mt:SetVarBlock name="category_basename"> <$mt:CategoryBasename$></mt:SetVarBlock>
        </mt:If>
    </mt:EntryCategories>
    <div class="post<$mt:Var name="category_basename"$>">
        <mt:EntryCategories>
            <mt:If tag="CategoryLabel" like="(Explore|Savor|Inside|Offbeat|Celebrate)">
            <a href="<$mt:ArchiveLink type="Category"$>"><$mt:CategoryLabel$></a>
            </mt:If>
        </mt:EntryCategories>
        <!-- more entry data here -->
    </div>
    <$mt:SetVar name="category_basename" value=""$>
</mt:Entries>

EntryCategory

This tag outputs the label of the main category for the entry.

<$mt:EntryCategory$>

Must be used in an entry context (entry archive or mt:Entries loop).

All entry categories can be listed using mt:EntryCategories loop tag.

Examples

Create a link to the Category archive of the entry’s main category (when in entry context):

<a href="<$mt:EntryLink type="Category"$>"><$mt:EntryCategory$></a>

Tip: Due to legacy taging the mt:EntryCategory function tag will output the same value as the mt:FolderLabel function tag when used in the context of a page. Unlike the mt:PageFolder tag which is block tag and must be used with the mt:FolderLabel tag.

Use this mtml

 <mt:If tag="EntryCategory" eq="Appendix: Configuration Directives">
     This main folder for this page is "Appendix: Configuration Directives".
     Confirmation using `mt:EntryCategory`: "<$mt:EntryCategory$>".
 </mt:If>

EntryClass

Pages and entries are technically very similar to one another. In fact most, if not all, of the <mt:Entry*> tags will work for publishing pages and vice versa. Therefore, to more clearly differentiate within templates between pages and entries the <mt:EntryClass> tag returns one of two values: "page" or "entry" depending upon the current context you are in.

Example:

    <mt:If tag="EntryClass" eq="page">
        (we're publishing a page)
    <mt:Else>
        (we're publishing something else -- probably an entry)
    </mt:If>

EntryClassLabel

Returns the localized name of the type of entry being published. For English blogs, this is the word "Page" or "Entry".

Example:

    <$mt:EntryClassLabel$>

EntryCommentCount

Outputs the number of published comments for the current entry in context.

EntryCreatedDate

Outputs the creation date of the current entry in context. See the Date tag for supported attributes.

EntryCustomFieldDescription

Deprecated: Same as mt:CustomFieldDescription. See EntryCustomFields for more info.

This will display the description of the current custom field in context.

EntryCustomFieldName

Deprecated: Same as mt:CustomFieldName. See EntryCustomFields for more info.

This will display the name of the current custom field in context.

EntryCustomFields

This container tag iterates, or loops, over all custom fields associated with an entry.

<mt:Entries>
    <mt:EntryCustomFields>
        <$mt:CustomFieldName$>
    </mt:EntryCustomFields>
</mt:Entries>

Filter the list of fields using the include or exclude attributes.

Attributes

include

Value is the name of the custom fields you wish to include from the loop:

<mt:EntryCustomFields include="Foo Field, Bar Field">
    <$mt:CustomFieldName$>
</mt:EntryCustomFields>

exclude

Value is the name of the custom fields you wish to exclude from the loop:

<mt:EntryCustomFields exclude="Foo Field, Bar Field">
    <$mt:CustomFieldName$>
</mt:EntryCustomFields>

Examples

Display Custom Field Data

The following mtml code will loop through every custom field and output the function tags: mt:CustomFieldName, mt:CustomFieldDescription, mt:CustomFieldValue (using the "default" to apply "[no value]" as a default value), mt:CustomFieldBasename, mt:CustomFieldHTML (attributes encodehtml and strip added to encode html attribtutes and place output on one line, respectivly. Remove these attributes when actual html form elements are desired)...

<mt:Entries>
    <h1><$mt:EntryTitle$></h1>
    <pre>
    <mt:EntryCustomFields>
        CustomFieldName:        <$mt:CustomFieldName$>
        CustomFieldDescription: <$mt:CustomFieldDescription$>
        CustomFieldValue:       <$mt:CustomFieldValue _default="[no value]"$>
        CustomFieldBasename:    <$mt:CustomFieldBasename$>
        CustomFieldHTML:        <$mt:CustomFieldHTML encode_html="1" strip=" "$>
    </mt:EntryCustomFields>
    </pre>
</mt:Entries>

The following tags are more specific aliases of the more generic tags in the above example:

Related

EntryCustomFieldValue

Deprecated: Same as mt:CustomFieldValue. See EntryCustomFields for more info.

This will display the value of the current custom field in context.

EntryDate

Outputs the 'authored' date of the current entry in context. See the Date tag for supported attributes.

EntryEditLink

A link to edit the entry in context from the Movable Type CMS. This tag is only recognized in system templates where an authenticated user is logged-in.

Attributes:

  • text (optional; default "Edit")

    A phrase to use for the edit link.

Example:

    <$mt:EntryEditLink$>

EntryEmbedCode

This template tag outputs the embedded (embed) parameters for a Embedded Object (Video) post.

This template tag is related to the custom fields that are automatically generated when you use Motion template sets. It can only be used with blogs created with Motion template sets.



Example:
<mt:Entries>
<mt:EntriesHeader>
<ul>
</mt:EntriesHeader>
<$mt:EntryPostType setvar="post_type"$>
<li>
<mt:If name="entry_type" eq="photo">
<$mt:EntryPhoto$>
</mt:If>
<mt:If name="entry_type" eq="link">
<$mt:EntryLinkURL$>
</mt:If>
<mt:If name="entry_type" eq="embed">
<$mt:EntryEmbedCode$>
</mt:If>
<mt:If name="entry_type" eq="audio">
<$mt:EntryAudio$>
</mt:If>
</li>
<mt:EntriesFooter>
</ul>
</mt:EntriesFooter>
</mt:Entries>

EntryExcerpt

Ouputs the value of the excerpt field of the current entry in context. If the excerpt field is empty, it will draw from the main text of the entry to generate an excerpt.

Attributes:

  • no_generate (optional)

    If the excerpt field is empty, this flag will prevent the generation of an excerpt using the main text of the entry.

  • words (optional; default "40")

    Controls the length of the auto-generated entry excerpt. Does not limit the content when the excerpt field contains content.

  • convert_breaks (optional; default "0")

    When set to '1', applies the text formatting filters on the excerpt content.

EntryFlag

Used to output any of the status fields for the current entry in context.

Attributes:

  • flag (required)

    Accepts one of: 'allow_pings', 'allow_comments'.

EntryID

Ouptuts the numeric ID for the current entry in context.

Attributes:

  • pad (optional; default "0")
    Adds leading zeros to create a 6 character string. The default is 0 (false). This is equivalent to using the `zero_pad` global filter with a value of 6.

EntryIfAllowComments

Conditional tag that is positive when the entry in context is configured to allow commenting and the blog and MT installation also permits comments.

EntryIfAllowPings

Deprecated in favor of IfPingsAccepted.

EntryIfCategory

Deprecated: This tag has been deprecated in favor of mt:IfCategory.

Returns true if the current page or entry belongs to the designated category.

Attributes

An attribute of label is required.

label

Label of the Category being conditioned.

name

Alias of label

Example

<mt:EntryIfCategory label="News">
  <!- do something ->
<mt:else>
  <!- do something else ->
</mt:EntryIfCategory>

EntryIfCommentsOpen

Deprecated in favor of EntryIfCommentsActive.

EntryIfExtended

Conditional tag that is positive when content is in the extended text field of the current entry in context.

EntryIfTagged

This template tag evaluates a block of code if a tag has been assigned to the current entry in context.

If the tag attribute is not assigned, then the template tag will evaluate if any tag is present.

Check for a specific tag…

<mt:EntryIfTagged tag="Foo">
    This entry has the tag "Foo"
</mt:EntryIfTagged>

Check if any tags are assigned to the entry…

<mt:EntryIfTagged>
    This entry has tags
</mt:EntryIfTagged>

Context

Attributes

tag

If present, the template tag will evaluate if the specified tag is assigned to the current entry.

Example

Conditional if tagged “Foo” or not:

<mt:EntryIfTagged tag="Foo">
    <!-- do something -->
<mt:Else>
    <!-- do something else -->
</mt:EntryIfTagged>

Condition based upon if a entry is tagged with the private tag @draft:

<mt:Entries>
    <li class="entry <mt:EntryIfTagged tag="@draft">draft</mt:EntryIfTagged>">
        <a href="<$mt:EntryPermalink$>"><$mt:EntryTitle$></a>
        <mt:EntryIfTagged tag="@draft">(draft)</mt:EntryIfTagged>
    </li>
</mt:Entries>

Bugs

Related

EntryKeywords

Outputs the value of the keywords field for the current entry in context.

EntryLink

Outputs absolute URL pointing to an archive page related to the the current entry in context.

When used without the archive_type attribute, a link to the entry permalink (individual) will be output… same as if the <$mt:EntryPermalink$> was used.

Link to the main category archive of the entry in context:

<a href="<$mt:EntryLink type="Category"$>"><$mt:EntryCategory$></a>

If the same archive mapping type is used more than once in the same blog, a url to the preferred archive will be output.

Note: The preferred archive can be selected by selecting the checkbox next to the archive mapping type in the Template Options for the template you wish to be the preferred template.

Attributes

archive_type

Identifies the archive type to use when creating the link.

Valid archive types are case sensitive:

  • Individual (default value)
  • Daily
  • Weekly
  • Monthly
  • Yearly
  • Author
  • Author-Daily
  • Author-Weekly
  • Author-Monthly
  • Author-Yearly
  • Category
  • Category-Daily
  • Category-Weekly
  • Category-Monthly
  • Category-Yearly

type

Alias of archive_type.

Examples

Link to the main category archive of the entry in context:

<a href="<$mt:EntryLink type="Category"$>"><$mt:EntryCategory$></a>

Link to the appropriate Monthly archive for the current entry (assuming Monthly archives are published), you can use this:

<a href="<$mt:EntryLink type="Monthly"$>"><$mt:EntryDate format="%B %Y"$> Archives</a>

Link to other entries by the current author (assuming Author archives are published):

<a href="<$mt:EntryLink type="Author"$>"><$mt:EntryAuthorDisplayName$></a>

Related Tags

EntryLinkURL

This template tag outputs the URL object of a URL post. This is different than the <MTEntryPermalink>, which outputs the URL of the post itself.

This template tag is related to the custom fields that are automatically generated when you use Motion template sets. It can only be used with blogs created with Motion template sets.



Example:
<mt:Entries>
<mt:EntriesHeader>
<ul>
</mt:EntriesHeader>
<$mt:EntryPostType setvar="post_type"$>
<li>
<mt:If name="entry_type" eq="photo">
<$mt:EntryPhoto$>
</mt:If>
<mt:If name="entry_type" eq="link">
<$mt:EntryLinkURL$>
</mt:If>
<mt:If name="entry_type" eq="embed">
<$mt:EntryEmbedCode$>
</mt:If>
<mt:If name="entry_type" eq="audio">
<$mt:EntryAudio$>
</mt:If>
</li>
<mt:EntriesFooter>
</ul>
</mt:EntriesFooter>

</mt:Entries>



EntryModifiedDate

Outputs the modification date of the current entry in context. See the Date tag for supported attributes.

EntryMore

Outputs the "extended" text of the current entry in context. Refer to the EntryBody tag for supported attributes.

EntryNext

A block tag providing a context for the entry immediately following the current entry in context (in terms of authored date).

Bug: In Movable Type 4.x there is a bug where if entries/pages have the exact same date-time then the mt:EntryPrevious and mt:EntryNext container tags may skip an entry/page. This has been fixed in Movable Type 5.

Example

<mt:Entries>
    <$mt:EntryTitle$>
    <mt:EntryNext>
        The next entry is:
        <a href="<$mt:EntryPermalink$>"><$mt:EntryTitle$></a>
    </mt:EntryNext>
</mt:Entries>

Related

EntryPermalink

An absolute URL pointing to the archive page containing this entry. An anchor (#) is included if the permalink is not pointing to an Individual Archive page.

Most of the time, you'll want to use this inside a hyperlink. So, inside any Entries loop, you can make a link to an entry like this:

    <a href="<$mt:EntryPermalink$>"><$mt:EntryTitle$></a>

Attributes:

  • type or archive_type (optional)

    Specifies an alternative archive type to use instead of the individual archive.

  • valid_html (optional; default "0")

    When publishing entry permalinks for non-individual archive templates, an anchor must be appended to the URL for the link to point to the proper entry within that archive. If 'valid_html' is unspecified, the anchor name is simply a number-- the ID of the entry. If specified, an 'a' is prepended to the number so the anchor name is considered valid HTML.

  • with_index (optional; default "0")

    If assigned, will retain any index filename at the end of the permalink.


EntryPermalink supports a whole bunch of additional attributes to help format the output of the tag. Using those attributes, you can escape the content so it shows up correctly in HTML, JavaScript, PHP, XML or other forms of output.

In the past, mt:EntryPermalink has been known as MTEntryPermalink, too. If you want to link to an Entry in one of the other archives it appears in, the mt:EntryLink tag will let you link to that entry as part of a Monthly archive, a Category archive, an Author archive or many other contexts.

EntryPhoto

This template tag outputs the image (img) parameters for a Photo post.

This template tag is related to the custom fields that are automatically generated when you use Motion template sets. It can only be used with blogs created with Motion template sets.



Example:
<mt:Entries>
<mt:EntriesHeader>
<ul>
</mt:EntriesHeader>
<$mt:EntryPostType setvar="post_type"$>
<li>
<mt:If name="entry_type" eq="photo">
<$mt:EntryPhoto$>
</mt:If>
<mt:If name="entry_type" eq="link">
<$mt:EntryLinkURL$>
</mt:If>
<mt:If name="entry_type" eq="embed">
<$mt:EntryEmbedCode$>
</mt:If>
<mt:If name="entry_type" eq="audio">
<$mt:EntryAudio$>
</mt:If>
</li>
<mt:EntriesFooter>
</ul>
</mt:EntriesFooter>
</mt:Entries>

EntryPrevious

A block tag providing a context for the entry immediately preceding the current entry in context (in terms of authored date).

Bug: In Movable Type 4.x there is a bug where if entries/pages have the exact same date-time then the mt:EntryPrevious and mt:EntryNext container tags may skip an entry/page. This has been fixed in Movable Type 5.

Example

<mt:Entries>
    <$mt:EntryTitle$>
    <mt:EntryPrevious>
        The previous entry is:
        <a href="<$mt:EntryPermalink$>"><$mt:EntryTitle$></a>
    </mt:EntryPrevious>
</mt:Entries>

Related

EntryRank

A function tag which returns a number from 1 to 6 (by default) which represents the rating of the entry in context in terms of total score where '1' is used for the highest score, '6' for the lowest score.

Attributes:

  • namespace (required)

    Specify namespace for rank to be calculated. Namespace is defined by each plugin which leverages rating API.

  • max (optional; default "6")

    Allows a user to specify the upper bound of the scale.

Example:

    <$mt:EntryRank namespace="FiveStarRating"$>

EntryRawPostType

This template tag outputs an entry's post type. Post types include:
  • Traditional blog post
  • Photo post
  • URL/Link post
  • Embed/Video post
  • Audio post


This template tag is related to the custom fields that are automatically generated when you use Motion template sets. It can only be used with blogs created with Motion template sets.



Example:
<mt:Entries lastn="5">
<mt:EntriesHeader>
<ul>
</mt:EntriesHeader>
<li class="post type-<$mt:EntryPostType$>"><$mt:EntryTitle$></li>
<mt:EntriesFooter>
</ul>
</mt:EntriesFooter>
</mt:Entires>

When the Motion Template Set is used, you can submit posts that contain more than simple text.


EntryScore

A function tag that provides total score of the entry in context. Scores grouped by namespace of a plugin are summed to calculate total score of an entry.

Attributes:

  • namespace (required)

    Specify namespace for score to be calculated. Namespace is defined by each plugin which leverages rating API.

Example:

    <$mt:EntryScore namespace="FiveStarRating"$>

EntryScoreAvg

A function tag that provides the avarage score of the entry in context. Scores grouped by namespace of a plugin are summed to calculate total score of an entry, and average is calculated by dividing the total score by the number of scorings or 'votes'.

Attributes:

  • namespace (required)

    Specify namespace for avarage score to be calculated. Namespace is defined by each plugin which leverages rating API.

Example:

    <$mt:EntryScoreAvg namespace="FiveStarRating"$>

EntryScoreCount

A function tag that provides the number of scorings or 'votes' made to the entry in context. Scorings grouped by namespace of a plugin are summed.

Attributes:

  • namespace (required)

    Specify namespace for the number of scorings to be calculated. Namespace is defined by each plugin which leverages rating API.

Example:

    <$mt:EntryScoreCount namespace="FiveStarRating"$>

EntryScoreHigh

A function tag that provides the highest score of the entry in context. Scorings grouped by namespace of a plugin are sorted to find the highest score of an entry.

Attributes:

  • namespace (required)

    Specify namespace for score to be calculated. Namespace is defined by each plugin which leverages rating API.

Example:

    <$mt:EntryScoreHigh namespace="FiveStarRating"$>

EntryScoreLow

A function tag that provides the lowest score of the entry in context. Scorings grouped by namespace of a plugin are sorted to find the lowest score of an entry.

Attributes:

  • namespace (required)

    Specify namespace for the score to be sorted. Namespace is defined by each plugin which leverages rating API.

Example:

    <$mt:EntryScoreLow namespace="FiveStarRating"$>

EntryStatus

Intended for application template use only. Displays the status of the entry in context. This will output one of "Draft", "Publish", "Review" or "Future".

EntryTags

A container tag used to output infomation about the entry tags assigned to the entry in context.

To avoid printing out the leading text when no entry tags are assigned you can use the EntryIfTagged conditional block to first test for entry tags on the entry. You can also use the EntryIfTagged conditional block with the tag attribute to test for the assignment of a particular entry tag.

Attributes:

  • glue

    A text string that is used to join each of the items together. For example:

        <mt:EntryTags glue=", "><$mt:TagName$></mt:EntryTags>

    would print out each tag name separated by a comma and a space.

Example:

The following code can be used anywhere Entries can be used. It prints a list of all of the tags assigned to each entry returned by Entries glued together by a comma and a space.

    <mt:If tag="EntryTags">
        The entry "<$mt:EntryTitle$>" is tagged:
        <mt:EntryTags glue=", "><$mt:TagName$></mt:EntryTags>
    </mt:If>

EntryTitle

Outputs the title of the current entry in context.

Attributes:

  • generate (optional)

    If specified, will draw content from the "main" text field of the entry if the title is empty.


EntryTitle supports a whole bunch of attributes to help format the output of the tag. Using those attributes, you can escape the content so it shows up correctly in HTML, JavaScript, PHP, XML or other forms of output.

In the past, mt:EntryTitle has been known as MTEntryTitle, too.

EntryTrackbackCount

Outputs the number of published TrackBack pings for the current entry in context.

EntryTrackbackData

Outputs the TrackBack RDF block that allows for TrackBack autodiscovery to take place. If TrackBack is not enabled for the entry, this will output an empty string.

Attributes:

  • comment_wrap (optional; default "1")

    If enabled, will enclose the RDF markup inside an HTML comment tag.

  • with_index (optional; default "0")

    If specified, will leave any "index.html" (or appropriate index page filename) in the permalink of the entry in context. By default this portion of the permalink is removed, since it is usually unnecessary.

EntryTrackbackID

Outputs the numeric ID of the TrackBack for the current entry in context. If not TrackBack is not enabled for the entry, this outputs an empty string.

EntryTrackbackLink

Outputs the TrackBack endpoint for the current entry in context. If TrackBack is not enabled for the entry, this will output an empty string.

ErrorMessage

This tag is used by the system to display the text of any user error message. Used in system templates, such as the 'Comment Response' template.

F

Feed

Type: block

Example

<mt:Feed>
  <!-- do something -->
</mt:Feed>

FeedbackScore

Outputs the numeric junk score calculated for the current comment or TrackBack ping in context. Outputs '0' if no score is present. A negative number indicates spam.

FeedEntries

Type: block

Example

<mt:FeedEntries>
  <!-- do something -->
</mt:FeedEntries>

FeedEntryLink

Type: function

Example

<mt:FeedEntryLink />

FeedEntryTitle

Type: function

Example

<mt:FeedEntryTitle />

FeedInclude

Type: function

Example

<mt:FeedInclude />

FeedLink

Type: function

Example

<mt:FeedLink />

FeedTitle

Type: function

Example

<mt:FeedTitle />

FileTemplate

Produces a file name and path using the archive file naming specifiers.

Attributes:

  • format

    A required attribute that defines the template with a string of specifiers. The supported specifiers are (NOTE: do not confuse the following table with the specifiers used for MT date tags. There is no relationship between these -- any similarities are coincidental. These specifiers are tuned for publishing filenames and paths for various contexts.)

    • %a

      The entry's author's display name passed through the dirify global filter. Example: melody_nelson

    • %-a

      The same as above except using dashes. Example: melody-nelson

    • %b

      For individual archive mappings, this returns the basename of the entry. By default, this is the first thirty characters of an entry dirified with underscores. It can be specified by using the basename field on the edit entry screen. Example: my_summer_vacation

    • %-b

      Same as above but using dashes. Example: my-summer-vacation

    • %c

      The entry's primary category/subcategory path, built using the category basename field. Example: arts_and_entertainment/tv_and_movies

    • %-c

      Same as above but using dashes. Example: arts-and-entertainment/tv-and-movies

    • %C

      The entry's primary category label passed through the dirify global filter. Example: arts_and_entertainment

    • %-C

      Same as above but using dashes. Example: arts-and-entertainment

    • %d

      2-digit day of the month. Example: 09

    • %D

      3-letter language-dependent abbreviation of the week day. Example: Tue

    • %e

      A numeric entry ID padded with leading zeroes to six digits. Example: 000040

    • %E

      The entry's numeric ID. Example: 40

    • %f

      Archive filename with the specified extension. This can be used instead of %b or %i and will do the right thing based on the context. Example: entry_basename.html or index.html

    • %F

      Same as above but without the file extension. Example: filename

    • %h

      2-digit hour on a 24-hour clock with a leading zero if applicable. Example: 09 for 9am, 16 for 4pm

    • %H

      2-digit hour on a 24-hour clock without a leading zero if applicable. Example: 9 for 9am, 16 for 4pm

    • %i

      The setting of the IndexBasename configuration directive with the default file extension appended. Example: index.html

    • %I

      Same as above but without the file extension. Example: index

    • %j

      3-digit day of year, zero-padded. Example: 040

    • %m

      2-digit month, zero-padded. Example: 07

    • %M

      3-letter language-dependent abbreviation of the month. Example: Sep

    • %n

      2-digit minute, zero-padded. Example: 04

    • %s

      2-digit second, zero-padded. Example: 01

    • %x

      File extension with a leading dot (.). If a file extension has not been specified a blank string is returned. Example: .html

    • %y

      4-digit year. Example: 2005

    • %Y

      2-digit year with zero-padding. Example: 05

Example:

    <$mt:FileTemplate format="%y/%m/%f"$>

FolderBasename

Produces the dirified basename defined for the folder in context.

Attributes:

  • default

    A value to use in the event that no folder is in context.

  • separator

    Valid values are "_" and "-", dash is the default value. Specifying an underscore will convert any dashes to underscores. Specifying a dash will convert any underscores to dashes.

Example:

    <$mt:FolderBasename$>

FolderCount

The number published pages in the folder.

Example:

    <$mt:FolderCount$>

FolderCustomFieldDescription

Deprecated: Same as mt:CustomFieldDescription. See EntryCustomFields for more info.

This will display the description of the current custom field in context.

FolderCustomFieldName

Deprecated: Same as mt:CustomFieldValue. See EntryCustomFields for more info.

This will display the value of the current custom field in context.

FolderCustomFields

This container tag iterates, or loops, over the list of custom fields associated with an folder.

See mt:EntryCustomFields for more details.

<mt:Folders>
    <mt:FolderCustomFields>
        <$mt:CustomFieldName$>
    </mt:FolderCustomFields>
</mt:Folders>

Attributes

exclude

Custom field name of the field you wish to exclude from the loop.

<mt:FolderCustomFields exclude="Foo Field">
    <$mt:CustomFieldName$>
</mt:FolderCustomFields>

Examples

See mt:EntryCustomFields for more examples.

Related

FolderCustomFieldValue

Deprecated: Same as mt:CustomFieldValue. See EntryCustomFields for more info.

This will display the value of the current custom field in context.

FolderDescription

The description for the folder in context.

Example:

    <$mt:FolderDescription$>

FolderFooter

The contents of this container tag will be displayed when the last folder listed by a Folders tag is reached.

FolderHeader

The contents of this container tag will be displayed when the first folder listed by a Folders tag is reached.

FolderID

The numeric system ID of the folder.

Example:

    <$mt:FolderID$>

FolderLabel

The label of the folder in context.

Examples

In a Page archive template, list the folder label which the page is in:

<mt:PageFolder>
    <$mt:FolderLabel$>
</mt:PageFolder>

Note: Because folders don’t have archive templates, there is no <$mt:FolderArchiveLink$> because there is no guarantee that a page with the basename of index exists in the folder. Thus linking to the folder must be created manually using “<$mt:BlogURL$><$mt:FolderPath$>/”.

In order to create a link to the folder’s URL the href must be constructed using mt:BlogURL and mt:FolderPath:

<mt:PageFolder>
    <a href="<$mt:BlogURL$><$mt:FolderPath$>/"><$mt:FolderLabel$></a>
</mt:PageFolder>

FolderNext

A container tag which creates a folder context of the next folder relative to the current page folder or archived folder.

FolderPath

The path to the folder, relative to the BlogURL.

Example:

For the folder "Bar" in a folder "Foo" <$mt:FolderPath$> becomes foo/bar.

FolderPrevious

A container tag which creates a folder context of the previous folder relative to the current page folder or archived folder.

Folders

A container tags which iterates over a list of all folders and subfolders.

Attributes:

  • show_empty

    Setting this optional attribute to true (1) will include folders with no pages assigned. The default is false (0), where only folders with pages assigned.

For

Many programming languages support the notion of a "for" loop. In the most simple use case one could give, a for loop is a way to repeatedly execute a piece of code n times.

Technically a for loop advances through a sequence (e.g. all odd numbers, all even numbers, every nth number, etc), giving the programmer greater control over the seed value (or "index") of each iteration through the loop.

Attributes:

  • var (optional)

    If assigned, the current 'index' of the loop is assigned to this template variable.

  • from (optional; default "0")
  • start

    Identifies the starting number for the loop.

  • to
  • end

    Identifies the ending number for the loop. Either 'to' or 'end' must be specified.

  • step (optional; default "1")
  • increment

    Provides the amount to increment the loop counter.

  • glue (optional)

    If specified, this string is added inbetween each block of the loop.

Within the tag, the following variables are assigned:

  • __first__

    Assigned 1 when the loop is in the first iteration.

  • __last__

    Assigned 1 when the loop is in the last iteration.

  • __odd__

    Assigned 1 when the loop index is odd, 0 when it is even.

  • __even__

    Assigned 1 when the loop index is even, 0 when it is odd.

  • __index__

    Holds the current loop index value, even if the 'var' attribute has been given.

  • __counter__

    Tracks the number of times the loop has run (starts at 1).

Example:

    <mt:For from="2" to="10" step="2" glue=","><$mt:Var name="__index__"$></mt:For>

Produces:

    2,4,6,8,10

G

GetVar

An alias for the 'Var' tag, and considered deprecated in favor of 'Var'.

H

HasNoParentCategory

Returns true if the current category does not have a parent category.

<mt:Categories>
    <mt:HasNoParentCategory>
        <$mt:CategoryLabel$> has no parent category.
    </mt:HasNoParentCategory>
</mt:Categories>

This type of conditioning can be done with the mt:IfCategory tag as well.

Example

List categories and note if each has a parent or not:

<ul>
<mt:Categories>
    <li>
    <mt:HasNoParentCategory>
        <$mt:CategoryLabel$> has no parent category.
    <mt:Else>
        <$mt:CategoryLabel$> has a parent category.
    </mt:HasNoParentCategory>
    </li>
</mt:Categories>
</ul>

Related

HasNoSubCategories

Returns true if the current category has no sub-categories.

HasParentCategory

Returns true if the current category has a parent category.

<mt:Categories>
    <mt:HasParentCategory>
        <$mt:CategoryLabel$> has a parent category.
    </mt:HasParentCategory>
</mt:Categories>

This type of conditioning can be done with the mt:IfCategory tag as well.

Example

List categories noting if each has a parent or not. If has a parent, list the parent category:

<ul>
<mt:Categories>
    <li>
    <mt:HasParentCategory>
        <$mt:CategoryLabel$> has a parent category.
        <mt:ParentCategory>
            (Parent Category: <a href="<mt:ArchiveLink>"><mt:CategoryLabel></a>)
        </mt:ParentCategory>
    <mt:Else>
        <$mt:CategoryLabel$> has no parent category.
    </mt:HasParentCategory>
    </li>
</mt:Categories>
</ul>

Related

HasParentFolder

Returns true if the current folder has a parent folder other than the root.

HasSubCategories

Returns true if the current category has a sub-category.

HasSubFolders

Returns true if the current folder has a sub-folder.

HTTPContentType

When this tag is used in a dynamically published index template, the value specified to the type attribute will be returned in the Content-Type HTTP header sent to web browser. This content is never displayed directly to the user but is instead used to signal to the browser the data type of the response.

When this tag is used in a system template, such as the search results template, mt-search.cgi will use the value specified to "type" attribute and returns it in Content-Type HTTP header to web browser.

When this tag is used in statically published template, this template tag outputs nothing.

Attributes:

  • type

    A valid HTTP Content-Type value, for example 'application/xml'. Note that you must not specify charset portion of Content-Type header value in this attribute. MT will set the portion automatically by using PublishCharset configuration directive.

Example:

    <$mt:HTTPContentType type="application/xml"$>

I

If

A conditional block that is evaluated if the attributes/modifiers evaluate true. This tag can be used in combination with the ElseIf and Else tags to test for a variety of cases.

Attributes:

  • name
  • var

    Declares a variable to test. When none of the comparison attributes are present ("eq", "ne", "lt", etc.) the If tag tests if the variable has a "true" value, meaning if it is assigned a non-empty, non-zero value.

  • tag

    Declares a MT tag to execute; the value of which is used for testing. When none of the comparison attributes are present ("eq", "ne", "lt", etc.) the If tag tests if the specified tag produces a "true" value, meaning if it produces a non-empty, non-zero value. For MT conditional tags, the If tag passes through the logical result of that conditional tag.

  • op

    If specified, applies the specified mathematical operator to the value being tested. 'op' may be one of the following (those that require a second value use the 'value' attribute):

    • + or add

      Addition.

    • - or sub

      Subtraction.

    • ++ or inc

      Adds 1 to the given value.

    • -- or dec

      Subtracts 1 from the given value.

    • * or mul

      Multiplication.

    • / or div

      Division.

    • % or mod

      Issues a modulus operator.

  • value

    Used in conjunction with the 'op' attribute.

  • eq

    Tests whether the given value is equal to the value of the 'eq' attribute.

  • ne

    Tests whether the given value is not equal to the value of the 'ne' attribute.

  • gt

    Tests whether the given value is greater than the value of the 'gt' attribute.

  • lt

    Tests whether the given value is less than the value of the 'lt' attribute.

  • ge

    Tests whether the given value is greater than or equal to the value of the 'ge' attribute.

  • le

    Tests whether the given value is less than or equal to the value of the 'le' attribute.

  • like

    Tests whether the given value matches the regex pattern in the 'like' attribute.

  • test

    Uses a Perl (or PHP under Dynamic Publishing) expression. For Perl, this requires the "Safe" Perl module to be installed.

Examples:

If variable "foo" has a non-zero value:

    <mt:SetVar name="foo" value="bar">
    <mt:If name="foo">
        <!-- do something -->
    </mt:If>

If variable "foo" has a value equal to "bar":

    <mt:SetVar name="foo" value="bar">
    <mt:If name="foo" eq="bar">
        <!-- do something -->
    </mt:If>

If variable "foo" has a value that starts with "bar" or "baz":

    <mt:SetVar name="foo" value="barcamp" />
    <mt:If name="foo" like="^(bar|baz)">
        <!-- do something -->
    </mt:If>

If tag <$mt:EntryTitle$> has a value of "hello world":

    <mt:If tag="EntryTitle" eq="hello world">
        <!-- do something -->
    </mt:If>

If tag <$mt:CategoryCount$> is greater than 10 add "(Popular)" after Category Label:

    <mt:Categories>
        <$mt:CategoryLabel$>
        <mt:If tag="CategoryCount" gt="10">(Popular)</mt:If>
    </mt:Categories>

If tag <$mt:EntryAuthor$> is "Melody" or "melody" and last name is "Nelson" or "nelson" then do something:

    <mt:Authors>
        <mt:If tag="EntryAuthor" like="/(M|m)elody (N|n)elson/"
            <!-- do something -->
        </mt:If>
    </mt:Authors>

If the <$mt:CommenterEmail$> matches foo@domain.com or bar@domain.com:

    <mt:If tag="CommenterEmail" like="(foo@domain.com|bar@domain.com)">
        <!-- do something -->
    </mt:If>

If the <$mt:CommenterUsername$> matches the username of someone on the Movable Type team:

    <mt:If tag="CommenterUsername" like="(beau|byrne|brad|jim|mark|fumiaki|yuji|djchall)">
        <!-- do something -->
    </mt:If>

If <$mt:EntryCategory$> is "Comic" then use the Comic template module otherwise use the default:

    <mt:If tag="EntryCategory" eq="Comic">
        <$mt:Include module="Comic Entry Detail"$>
    <mt:Else>
        <$mt:Include module="Entry Detail"$>
    </mt:If>

If <$mt:EntryCategory$> is "Comic", "Sports", or "News" then link to the category archive:

    <mt:If tag="EntryCategory" like="(Comic|Sports|News)">
        <a href="<$mt:CategoryArchiveLink$>"><$mt:CategoryLabel$></a>
    <mt:Else>
        <$mt:CategoryLabel$>
    </mt:If>

List all categories and link to categories it the category has one or more entries:

    <mt:Categories show_empty="1">
        <mt:If name="__first__">
    <ul>
        </mt:If>
        <mt:If tag="CategoryCount" gte="1">
        <li><a href="<$MTCategoryArchiveLink$>"><$MTCategoryLabel$></a></li>
        <mt:Else>
        <li><$MTCategoryLabel$></li>
        </mt:If>
        <mt:If name="__last__">
    </ul>
        </mt:If>
    </mt:Categories>

Test a variable using Perl:

    <mt:If test="length($some_variable) > 10">
        '<$mt:Var name="some_variable"$>' is 11 characters or longer
    </mt:If>


Related

IfAllowCommentHTML

Conditional block that is true when the blog has been configured to permit HTML in comments.

IfArchiveType

This tag allows you to conditionalize a section of template code based on whether the primary template being published is a specific type of archive template.

Attributes:

  • type
  • archive_type

    The archive type to test for, case-insensitively. See ArchiveType for acceptable values but note that plugins may also provide others.

If you wanted to include autodiscovery code for a customized Atom feed for each individual entry (perhaps for tracking comments) you could put this in your Header module. This would serve up the first link for Individual archives and the normal feed for all other templates:

    <mt:IfArchiveType type="individual">
        <link rel="alternate" type="application/atom+xml"
            title="Comments Feed"
            href="<$MTFileTemplate format="%y/%m/%-F.xml"$>" />
    <mt:Else>
        <link rel="alternate" type="application/atom+xml"
            title="Recent Entries"
            href="<$MTLink template="feed_recent"$>" />
    </mt:IfArchiveType>

IfArchiveTypeEnabled

A conditional tag used to test whether a specific archive type is published or not.

Attributes:

  • type or archive_type

    Specifies the name of the archive type you wish to check to see if it is enabled.

    A list of possible values values for type can be found on the EntryLink tag.

Example:

    <mt:IfArchiveTypeEnabled type="Category-Monthly">
        <!-- do something -->
    <mt:Else>
        <!-- do something else -->
    </mt:IfArchiveTypeEnabled>

IfAuthor

A conditional tag that is true when an author object is in context.

    <mt:IfAuthor>
        Author: <$mt:AuthorDisplayName$>
    </mt:IfAuthor>

IfBlog

A conditional tag that produces its contents when there is a blog in context. This tag is useful for situations where a blog may or may not be in context, such as the search template, when a search is conducted across all blogs.

Example:

    <mt:IfBlog>
        <h1>Search results for <$mt:BlogName$>:</h1>
    <mt:Else>
        <h1>Search results from all blogs:</h1>
    </mt:IfBlog>

IfCategory

A conditional tag for determining if the entry in context is assigned categories. Determine if in a specific category and/or if the category is a primary or secondary category.

<mt:IfCategory>
    <!-- Entry is assigned a category -->
</mt:IfCategory>

Attributes

label

The name of a category. Tests the category in context (or categories of an entry in context) to see if it matches with the given category name.

name

Alias of label.

type

Either the keyword “primary” or “secondary”. Used to test whether the specified category (specified by the label attribute) is a primary or secondary category assignment for the entry in context.

Examples

Determine if the entry in context is assigned a category:

<mt:IfCategory>
    <!-- Entry is assigned a category -->
<mt:Else>
    <!-- Entry is not assigned a category -->
</mt:IfCategory>

Determine if the entry in context has a secondary category assigned:

<mt:IfCategory type="secondary">
    <!-- entry in context is assigned to one or more secondary categories -->
</mt:IfCategory>

Determine if the entry in context is assigned the category “News”:

<mt:IfCategory label="News">
    <!-- entry in context is assigned to the "News" category -->
</mt:IfCategory>

Determine if the entry in context is the in the primary category “News”:

<mt:IfCategory label="News" type="primary">
    <!-- entry in context is assigned the primary category "News" -->
</mt:IfCategory>

IfCommenterIsAuthor

Conditional tag that is true when the current comment was left by a user who is also a native MT user.

IfCommenterIsEntryAuthor

Conditional tag that is true when the current comment was left by the author of the current entry in context.

IfCommenterTrusted

A conditional tag that displays its contents if the commenter in context has been marked as trusted.

IfCommentParent

A conditional tag that is true when the comment currently in context is a reply to another comment.

Example:

    <mt:IfCommentParent>
        (a reply)
    </mt:IfCommentParent>

IfCommentReplies

A conditional tag that is true when the comment currently in context has replies.

IfCommentsAccepted

Conditional tag that displays its contents if commenting is enabled for the entry in context.

Example:

    <mt:IfCommentsAccepted>
        <h3>What do you think?</h3>
        (comment form)
    </mt:IfCommentsAccepted>

IfCommentsActive

Conditional tag that displays its contents if comments are enabled or comments exist for the entry in context.

IfCommentsAllowed

Conditional block that is true when the blog is configured to accept comments, and comments are accepted on a system-wide basis. This tag does not take the current entry context into account; use the IfCommentsAccepted tag for this.

IfCommentsModerated

A conditional tag that is true when the blog is configured to moderate incoming comments from anonymous commenters.

IfCurrentPage

A conditional tag returns true if the current page in the context of PagerBlock is the current page that is being rendered. The tag must be used in the context of PagerBlock.

IfDynamic

Returns true if the current publishing context is dynamic publishing, and false otherwise.

IfFolder

A conditional tag used to test for the folder assignment for the page in context, or generically to test for which folder is in context.

Attributes:

  • name (or label; optional)

    The name of a folder. If given, tests the folder in context (or folder of an entry in context) to see if it matches with the given folder name.

Example:

    <mt:IfFolder name="News">
        (current page in context is in the "News" folder)
    </mt:IfFolder>

IfImageSupport

A conditional tag that returns true when the Movable Type installation has the Perl modules necessary for manipulating image files.

IfIsAncestor

Conditional tag that is true when the category in context is an ancestor category of the specified 'child' attribute.

Attributes:

  • child (required)

    The label of a category in the current blog.

Example:

    <mt:IfIsAncestor child="Featured">
        (category in context is a parent category
        to a subcategory named "Featured".)
    </mt:IfIsDescendant>

IfIsDescendant

Conditional tag that is true when the category in context is a child category of the specified 'parent' attribute.

Attributes:

  • parent (required)

    The label of a category in the current blog.

Example:

    <mt:IfIsDescendant parent="Featured">
        (category in context is a child category
        to the 'Featured' category.)
    </mt:IfIsDescendant>

IfMaxResultsCutoff

NOTE: this tag only applies if you are using older Movable Type than version 4.15, or you set up your search script so it instantiates MT::App::Search::Legacy, the older search script. Under the default search script in Movable Type, this tag will never be evaluated as true and therefore the contents will never be rendered.

A conditional tag that returns true when the number of search results per blog exceeds the maximium limit specified in MaxResults configuration directive.

This tag is only recognized in search templates.

IfMoreResults

A conditional tag used to test whether the requested content has more to show than currently appearing in the page.

IfNeedEmail

Conditional tag that is positive when the blog is configured to require an e-mail address for anonymous comments.

IfNonEmpty

A conditional tag used to test whether a template variable or tag are non-empty. This tag is considered deprecated, in favor of the If tag.

Attributes:

  • tag

    A tag which is evaluated and tested for non-emptiness.

  • name or var

    A variable whose contents are tested for non-emptiness.

IfNonZero

A conditional tag used to test whether a template variable or tag are non-zero. This tag is considered deprecated, in favor of the If tag.

Attributes:

  • tag

    A tag which is evaluated and tested for non-zeroness.

  • name or var

    A variable whose contents are tested for non-zeroness.

IfPingsAccepted

Conditional tag that is positive when pings are allowed for the blog and the entry (if one is in context) and the MT installation.

IfPingsActive

Conditional tag that displays its contents if TrackBack pings are enabled or pings exist for the entry in context.

IfPingsAllowed

Conditional tag that is positive when pings are allowed by the blog and the MT installation (does not test for an entry context).

IfPingsModerated

Conditional tag that is positive when the blog has a policy to moderate all incoming pings by default.

IfPreviousResults

A conditional tag used to test whether the requested content has previous page.

IfRegistrationAllowed

A conditional tag that is true when the blog has been configured to permit user registration.

Attributes:

  • type (optional)

    If specified, can be used to test if a particular type of registration is enabled. The core types include "OpenID", "Vox", "LiveJournal", "TypeKey" and "MovableType". The identifier is case-insensitive.

IfRegistrationNotRequired

A conditional tag that is true when the blog has been configured to permit anonymous comments.

IfRegistrationRequired

A conditional tag that is true when the blog has been configured to require user registration.

IfRequireCommentEmails

Conditional tag that is positive when the blog is configured to require an e-mail address for anonymous comments.

IfStatic

Returns true if the current publishing context is static publishing, and false otherwise.

IfStraightSearch

A conditional block which outputs its contents if the search in progress is a regular (or "straight") search.

IfTagSearch

A conditional block which outputs its contents if the search in progress is a search of entries by tag.

IfTypeKeyToken

A conditional tag that is true when the current blog in context has been configured with a TypeKey token.

Ignore

A block tag that always produces an empty string. This tag is useful for wrapping template code you wish to disable, or perhaps annotating sections of your template.

Example:

    <mt:Ignore>
        The API key for the following tag is D3ADB33F.
    </mt:Ignore>

ImageHeight

Outputs the uploaded image height in pixels (used only for the system template for uploaded images).

ImageURL

Outputs the uploaded image URL (used only for the system template for uploaded images).

ImageWidth

Outputs the uploaded image width in pixels (used only for the system template for uploaded images).

Include

Includes the contents of a template module or external file into the current template where is it used.

<$mt:Include module="Sidebar"$>

Attributes

Note: One of the following attributes is required and not more than one may be used:


blog_id

Used to include a template from another blog in the system. Use in conjunction with the module, widget, or identifier attributes.

<$mt:Include module="Sidebar" blog_id="1"$>

Using a value of “0” will include a global template module, same as if the global attribute is used.

Bug: MT5 Only - Module hierachy doesn’t cause a module to be included from a “website” object before being included from the “system” template modules. To include template modules from a website into a blog, use the following code:

<mt:BlogParentWebsite>
    <$mt:WebsiteID setvar="website_id"$>
</mt:BlogParentWebsite>
<$mt:Include module="Entry Metadata" blog_id="$website_id"$>

Fogbugz 102199: Include template modules from website templates before system templates

cache

Enables caching of the contents of the include. Used in conjunction with the ‘cache_key’ attribute. Suitable for module, widget, or identifier includes. Default value is “0”.

<mt:SetVarBlock name="cache_key"><mt:EntryCategory></mt:SetVarBlock>
<$mt:Include widget="Related Entries" key="$cache_key" ttl="3600" cache="1"$>

cache_key

Unique cache id use the template module. Used in conjunction with the ‘cache’ attribute. Suitable for module, widget, or identifier includes.

See cache for example.

file

The path to an external file on the system. The path can be absolute or relative to the Local Site Path. This file is included at the time your page is built. It should not be confused with dynamic server side includes like that found in PHP.

<$mt:Include file="/var/www/html/some-fragment.html"$>

global

Forces an Include of a globally defined template even if the template is also available in the blog currently in context. Default value is “0”.

<$mt:Include module="Sidebar" global="1"$>

(For module, widget, and identifier inc. Doesn’t have any effect on including file attribute.)

identifier

For selecting Index templates by their unique identifier.

<$mt:Include identifier="main_index"$>

key

Alias of cache_key.

module

The name of a template module in the current blog.

<$mt:Include module="Sidebar"$>

name

For application template use: identifies an application template by filename to load.

ssi

Causes the include to be handled as a server-side include. The value of the ssi attribute determines the type of include that is produced.

Acceptable values are: php, asp, jsp, shtml. Default value is “0”.

This causes the contents of the include to be processed and written to a file (stored to the blog’s publishing path, under the ‘includes_c’ subdirectory).

The include tag itself then returns the include directive appropriate to the ssi type specified.

To generate the contents for the “Tag Cloud” template module and write it to a “tag_cloud.php” file use this mtml:

<$mt:Include module="Tag Cloud" ssi="php"$>

The output is a php include tag:

<?php include("/path/to/blog/includes_c/tag_cloud.php") ?>

Suitable for module, widget, and identifier includes.

ttl

Specifies the lifetime in seconds of a cached template module. Suitable for module, widget or identifier includes.

See cache for example.

widget

The name of the widget in the current blog to include.

<$mt:Include widget="Search Box"$>

Examples

Also, other attributes given to this tag are locally assigned as variables when invoking the include template.

Variables in Attribute Values

Variables may be passed into the values. If various template modules were created for each category (such as “Foo Sidebar” for category “Foo” and “Bar Sidebar” for category “Bar”) then you could include the templates like this on an Entry archive template. This example also includes a default template if there is no category:

<mt:SetVarBlock name="sidebar_template"><$mt:EntryCategory$> Sidebar</mt:SetVarBlock>
<mt:If tag="EntryCategory">
    <$mt:Include module="$sidebar_template"$>
<mt:Else>
    <$mt:Include module="No Category Sidebar"$>
</mt:If>

Passing Parameters

Parameters may be defined before including a template or may be passed to the included template module as custom attribute. One variable (section_subtitle) is defined using the Var tag and the second variable (section_title) is defined as an attribute of the mt:include tag:

<$mt:Var name="section_subtitle" value="I am the subtitle"$>
<$mt:Include module="Section Header" section_title="Elsewhere"$>

The “Section Header” template module uses the values set by the include:

<h1><$mt:Var name="section_title" _default="Default Title Here"$></h1>
<h2><$mt:Var name="section_subtitle" _default="Default Subtitle Here"$></h2>

IncludeBlock

This tag is similar to a wrapper as it provides MT with the ability to 'wrap' content with an included module. This behaves much like the MTInclude tag, but it is a container tag. The contents of the tag are taken and assigned to a variable (either one explicitly named with a 'var' attribute, or will default to 'contents'). i.e.:

    <mt:IncludeBlock module="Some Module">
        (do something here)
    </mt:IncludeBlock>

In the "Some Module" template module, you would then have the following template tag allowing you to reference the contents of the IncludeBlock tag used to include this "Some Module" template module, like so:

    (header stuff)
    <$mt:Var name="contents"$>
    (footer stuff)

Important: Modules used as IncludeBlocks should never be processed as a Server Side Include or be cached

Attributes:

  • var (optional)

    Supplies a variable name to use for assigning the contents of the IncludeBlock tag. If unassigned, the "contents" variable is used.

IndexBasename

Outputs the IndexBasename MT configuration setting.

Attributes:

  • extension (optional; default "0")

    If specified, will append the blog's configured file extension.

IndexLink

Outputs the URL for the current index template in context. Used in an IndexList tag.

Attributes:

  • with_index (optional; default "0")

    If enabled, will retain the "index.html" (or similar index filename) in the link.

IndexList

A block tag that builds a list of all available index templates, sorting them by name.

IndexName

Outputs the name for the current index template in context. Used in an IndexList tag.

L

Link

Generates the absolute URL to an index template or specific entry in the system.

NOTE: Only one of the 'template', 'identifier' and 'entry_id' attributes can be specified at a time.

Attributes:

  • template

    The name of the index template.

  • identifier

    A template identifier.

  • entry_id

    The numeric system ID of the entry.

  • with_index (optional; default "0")

    If not set to 1, remove index filenames (by default, index.html) from resulting links.

Examples:

    <a href="<mt:Link template="About Page">">My About Page</a>

    <a href="<mt:Link entry_id="221">">the entry about my vacation</a>

    <a href="<mt:Link identifier="main_index">">Home</a>

Loop

Loop over the values in a hash or an array (see mt:If).

<mt:Loop name="author_ids">
    <$mt:Var name="__key__"$> = <$mt:Var name="__value__"$>
</mt:Loop>

This tag is primarily used for processing a Perl array of hashref data in the application templates, but can also be used in blog templates.

This tag’s heritage comes from the CPAN HTML::Template module and it’s TMPL_LOOP tag and offers similar capabilities.

This tag can also handle a hashref variable, which causes it to loop over all keys in the hash.

Attributes

name

The name of the array, hash data to process.

var

Alias of name.

sort_by

Causes the data in the given array to be resorted in the manner specified.

By default the values are ouput in the order they are stored in the array/hash.

Sort by keys in reverse order:

<mt:Loop name="author_ids" sort_by="key reverse">
    <!-- something here -->
</mt:Loop>

Multiple space-separated values may be used:

  • reverse - reverses the order
  • key - sort by key
  • value - sort by value
  • numeric - sort numerically by value (only necessary when combined with value attribute)

glue

If specified, this string will be placed in between each “row” of data produced by the loop tag.

Loop Variables

Within the tag, the following variables are assigned and may be used:

first

Assigned when the loop is in the first iteration.

last

Assigned when the loop is in the last iteration.

odd

Assigned 1 when the loop is on odd numbered rows, 0 when even.

even

Assigned 1 when the loop is on even numbered rows, 0 when odd.

key

When looping over a hashref template variable, this variable is assigned the key currently in context.

value

This variable holds the value of the array or hashref element currently in context.

Examples

Add values to an array, then output:

<$mt:Var name="sandwich" function="push" value="bacon"$>
<$mt:Var name="sandwich" function="push" value="lettuce"$>
<$mt:Var name="sandwich" function="push" value="tomato"$>

My BLT sandwich contains the following ingredients: 
<mt:Loop name="sandwich" glue=", ">
    <$mt:Var name="__value__"$>
</mt:Loop>

Place variables into a hash using SetHashVar and then access directly via keys using the name attribute:

<mt:SetHashVar name="my_hash">
    <$mt:Var name="foo" value="bar"$>
    <$mt:Var name="fizzle" value="fozzle"$>
</mt:SetHashVar>
<mt:Loop name="my_hash">
    <$mt:Var name="fizzle" $>
    <$mt:Var name="foo" $>
</mt:Loop>

List entry categories if their label is within the set Explore, Savor, Inside, Offbeat, or Celebrate and then glue them with “, “. Using mt:SevVarBlock with function=”push” attribute and then output with mt:Loop:

<mt:EntryCategories>
    <mt:If tag="CategoryLabel" like="(Explore|Savor|Inside|Offbeat|Celebrate)">
        <mt:SetVarBlock name="featured_categories" function="push">
            <a href="<$mt:CategoryArchiveLink$>"><$mt:CategoryLabel$></a>
        </mt:SetVarBlock>
    </mt:If>
</mt:EntryCategories>
<mt:Loop name="featured_categories">
    <$mt:Var name="__value__" trim="1"$><mt:Unless name="__last__">, </mt:Unless>
</mt:Loop>

Loop through the last 20 entries and list each author once (skip if already found), limit to 4. This code assumes that there will be at least 4 unique bloggers in the last 20 entries. If not increase the lastn value. View a simplified version of this using Hash Variables

<$mt:Var name="author_limit" value="4"$>
<$mt:Var name="author_count" value="0"$>
<mt:Entries lastn="20">
    <mt:EntriesHeader>
<h2>Recent Bloggers</h2>
<ul>
    </mt:EntriesHeader>
    <mt:If name="author_count" lt="$author_limit">
        <$mt:EntryAuthorID setvar="current_author_id"$>
        <$mt:Var name="skip" value="0"$>
        <mt:Loop name="author_ids">
            <mt:If name="current_author_id" eq="$__value__">
                <$mt:Var name="skip" value="1"$>
            </mt:If>
        </mt:Loop>
        <mt:Unless name="skip">
    <li>
        <$mt:EntryAuthorDisplayName encode_html="1"$><br />
        <a href="<$mt:EntryPermalink$>"><$mt:EntryTitle$></a>
    </li>
        </mt:Unless>
        <$mt:EntryAuthorID setvar="author_id"$>
        <$mt:Var name="author_ids" function="push" value="$author_id"$>
    </mt:If>
    <$mt:SetVar name="author_count" op="++"$>
    <mt:EntriesFooter>
</ul>
    </mt:EntriesFooter>
</mt:Entries>

M

MarkdownOptions

Type: block

Example

<mt:MarkdownOptions>
  <!-- do something -->
</mt:MarkdownOptions>

MaxResults

Returns the value of SearchMaxResults, specified either in configuration (via SearchMaxResults configuration directive) or in the search query parameter in the URL.

This tag is only recognized in search templates.

MultiBlog

Type: block

Examples

<mt:MultiBlog>
  <!-- do something -->
</mt:MultiBlog>

Include the last 4 entries from the category "Releases" in blog with the ID of 1

<MTMultiBlog include_blogs="1">
    <MTEntries category="Releases" lastn="4">
         <$MTEntryTitle$>
    </MTEntries>
</MTMultiBlog>

MultiBlogIfLocalBlog

Type: block

Example

<mt:MultiBlogIfLocalBlog>
  <!-- do something -->
<mt:else>
  <!-- do something else -->
</mt:MultiBlogIfLocalBlog>

MultiBlogLocalBlog

Type: block

Example

<mt:MultiBlogLocalBlog>
  <!-- do something -->
</mt:MultiBlogLocalBlog>

N

NextLink

A function tag returns the URL points to the next page of the current page that is being rendered.

NoSearch

A container tag whose contents are displayed only if there is no search performed.

This tag is only recognized in search templates.

NoSearchResults

A container tag whose contents are displayed if a search is performed but no results are found.

This tag is only recognized in search templates.

NotifyScript

Returns the value of the NotifyScript configuration setting. The default for this setting if unassigned is "mt-add-notify.cgi".

O

OtherBlog

Alias of multiblog

Example

<mt:OtherBlog>
  <!-- do something -->
</mt:OtherBlog>

OtherProfiles

This block template tag outputs a summary of services users have registered with Movable Type.   This tag can only be used with MT 4.25 and above.

Example:

<$mt:SetVar name="display_name" value="Melody"$>

<mt:OtherProfiles display_name="$display_name">
<mt:If name="__first__">
<div class="widget-elsewhere widget">
<h3 class="widget-header"><$mt:Var name="display_name"$> 's service summary</a></h3>
<div class="widget-content">
<ul>
</mt:If>
<li class="service-<$mt:OtherProfileVar name="type"$>"><a href="<$mt:OtherProfileVar name="uri" escape="html"$>"><$mt:OtherProfileVar name="label" escape="html"$></a></li>
<mt:If name="__last__">
</ul>
</div>
</div>
</mt:If>
</mt:OtherProfiles>

Attributes:

  • type="service type" (optional)

    Limits listed profiles to a certain type of service. Common service types are:

    • contact (AIM, Yahoo! Messenger, etc)
    • blog (Vox, Tumblr, the Website service, etc)
    • photos (Flickr, Smugmug, etc)
    • video (Vimeo, YouTube, etc)
    • links (del.icio.us, Digg, etc)
    • status ( Twitter, etc)
    • network (Facebook, MySpace, etc)

    If you only want to output profiles from "contact" type services, use the following:

    <mt:OtherProfiles type="contact">

    If you want to output profiles from all services except contact-type services, use the following:

    <mt:OtherProfiles type="NOT contact">
  • author="author username" (optional)

    Limits listed profiles to only specified authors' profiles. Use an author's login account name (username) here.

    For example, with this code only the profile of the author with the username "Melody" will be shown:

    <mt:OtherProfiles author="Melody">

    To show the profiles of several authors, separate their usernames with a comma:

    <mt:OtherProfiles author="Melody,Nelson">
  • display_name="author display name" (optional)

    Limits listed profiles to only specified users' profiles. Use an author's profile display name here.

    For example, with this code only the profile of the user with the display name "Melody Nelson" will be shown:

    <mt:OtherProfile display_name="Melody Nelson">

    To show the profiles of several authors, separate their display names with commas:

    <mt:OtherProfile display_name="Melody Nelson,Serge Gainsbourg">

    Only one of display_name and author should be specified. If neither are specified, the authors to show are inferred from context: if the tag is used in an author context (such as on an author archive page, inside an <mt:Authors> tag, in an entry context, or on an MT Pro profile page), that one author is selected; otherwise, if the tag is used in a blog context (most of the time), all the authors who can post to that blog are selected.

OtherProfileVar

This tag is a part of the Action Streams plugin bundled with Movable Type 4.25 and higher.

Provides a property of the current author profile, available in an <mt:OtherProfiles> loop.

Example:

<mt:OtherProfiles>
    <$mt:OtherProfileVar name="label"$>:
    <$mt:OtherProfileVar name="uri"$>
</mt:OtherProfiles>

Attributes:

  • name (required)

    The property of the selected profile to show. Available properties are:

    • type, the registry key/ID for the profile service
    • label, the human readable (for example, "Flickr Profile")
    • ident, the author's identifier for the current profile
    • uri, the URL of the author's profile on the remote service

P

PageAssets

A container tag which iterates over a list of assets for the current page in context. Supports all the attributes provided by the Assets tag.

PageAuthorDisplayName

The display name of the author of the page in context. If no display name is specified, returns an empty string, and no name is displayed.

Example:

    <$mt:PageAuthorDisplayName$>

PageAuthorEmail

The email address of the page's author.

Note: It is not recommended to publish email addresses.

Example:

    <$mt:PageAuthorEmail$>

PageAuthorLink

A linked version of the author's user name, using the author URL if provided in the author's profile. Otherwise, the author name is unlinked. This tag uses the author URL if available and the author email otherwise. If neither are on record the author name is unlinked.

Attributes:

  • show_email

    Specifies if the author's email can be displayed. The default is false (0).

  • show_url

    Specifies if the author's URL can be displayed. The default is true (1).

  • new_window

    Specifies to open the link in a new window by adding "target=_blank" to the anchor tag. See example below. The default is false (0).

Examples:

    <$mt:PageAuthorLink$>

    <$mt:PageAuthorLink new_window="1"$>

PageAuthorURL

The URL of the page's author.

Example:

    <$mt:PageAuthorURL$>

PageBasename

By default, the page basename is a constant and unique identifier for an page which is used as part of the individual pages's archive filename.

The basename is created by dirifiying the page title when the page is first saved (regardless of the page status). From then on, barring direct manipulation, the page basename stays constant even when you change the page's title. In this way, Movable Type ensures that changes you make to an page after saving it don't change the URL to the page, subsequently breaking incoming links.

The page basename can be modified by anyone who can edit the page. If it is modified after it is created, it is up to the user to ensure uniqueness and no incrementing will occur. This allows you to have complete and total control over your URLs when you want to as well as effortless simplicity when you don't care.

Attributes:

  • separator (optional)

    Valid values are "_" and "-", dash is the default value. Specifying an underscore will convert any dashes to underscores. Specifying a dash will convert any underscores to dashes.

Example:

    <$mt:PageBasename$>

PageBody

This tag outputs the contents of the page's Body field.

If a text formatting filter has been specified, it will automatically applied.

Attributes:

  • words

    Trims the number of words to display. By default all are displayed.

  • convert_breaks

    Controls the application of text formatting. By default convert_breaks is 0 (false). This should only be used if text formatting is set to "none" in the Entry/Page editor.

Example:

    <$mt:PageBody$>

PageCustomFieldDescription

Deprecated: Same as mt:CustomFieldDescription. See EntryCustomFields for more info.

This will display the description of the current custom field in context.

PageCustomFieldName

Deprecated: Same as mt:CustomFieldName. See EntryCustomFields for more info.

This will display the name of the current custom field in context.

PageCustomFields

This container tag iterates, or loops, over the list of custom fields associated with an page.

See mt:EntryCustomFields for more details.

<mt:Pages>
    <mt:PageCustomFields>
        <$mt:CustomFieldName$>
    </mt:PageCustomFields>
</mt:Pages>

Attributes

exclude

Custom field name of the field you wish to exclude from the loop.

<mt:PageCustomFields exclude="Foo Field">
    <$mt:CustomFieldName$>
</mt:PageCustomFields>

Examples

See mt:EntryCustomFields for more examples.

Related

PageCustomFieldValue

Deprecated: Same as mt:CustomFieldValue. See EntryCustomFields for more info.

This will display the value of the current custom field in context.

PageDate

The authored on timestamp for the page.

Attributes:

  • format

    A string that provides the format in which to publish the date. If unspecified, the default that is appropriate for the language of the blog is used (for English, this is "%B %e, %Y %l:%M %p"). See the Date tag for the supported formats.

  • language

    Forces the date to the format associated with the specified language.

  • utc

    Forces the date to UTC format.

Example:

    <$mt:PageDate$>

PageExcerpt

This tag outputs the contents of the page Excerpt field if one is specified or, if not, an auto-generated excerpt from the page Body field followed by an ellipsis ("...").

The length of the auto-generated output of this tag can be set in the blog's Entry Settings.

Attributes:

no_generate (optional; default "0")

When set to 1, the system will not auto-generate an excerpt if the excerpt field of the page is left blank. Instead it will output nothing.

* convert_breaks (optional; default "0")

When set to 1, the page's specified text formatting filter will be applied. By default, the text formatting is not applied and the excerpt is published either as input or auto-generated by the system.

Example:

    <$mt:PageExcerpt$>

PageFolder

A container tag which holds folder context relating to the page.

<mt:PageFolder>
    <$mt:FolderLabel$>
</mt:PageFolder>

Tip: Due to legacy taging the mt:EntryCategory function tag will output the same value as the mt:FolderLabel function tag when used in the context of a page. Unlike the mt:PageFolder tag which is block tag and must be used with the mt:FolderLabel tag.

Use this mtml

 <mt:If tag="EntryCategory" eq="Appendix: Configuration Directives">
     This main folder for this page is "Appendix: Configuration Directives".
     Confirmation using `mt:EntryCategory`: "<$mt:EntryCategory$>".
 </mt:If>

PageID

A numeric system ID of the Page currently in context.

Example:

    <$mt:PageID$>

PageIfTagged

This template tag evaluates a block of code if a tag has been assigned to the current page in context.

If the tag attribute is not assigned, then the template tag will evaluate if any tag is present.

Check for a specific tag…

<mt:PageIfTagged tag="Foo">
    This page has the tag "Foo"
</mt:PageIfTagged>

Check if any tags are assigned to the page…

<mt:PageIfTagged>
    This page has tags
</mt:PageIfTagged>

Context

Attributes

tag

If present, the template tag will evaluate if the specified tag is assigned to the current page.

Example

Conditional if tagged “Foo” or not:

<mt:PageIfTagged tag="Foo">
    <!-- do something -->
<mt:Else>
    <!-- do something else -->
</mt:PageIfTagged>

Condition based upon if a page is tagged with the private tag @draft:

<mt:Pages>
    <li class="page <mt:PageIfTagged tag="@draft">draft</mt:PageIfTagged>">
        <a href="<$mt:PagePermalink$>"><$mt:PageTitle$></a>
        <mt:PageIfTagged tag="@draft">(draft)</mt:PageIfTagged>
    </li>
</mt:Pages>

Bugs

Related

PageKeywords

The specified keywords of the page in context.

Example:

    <$mt:PageKeywords$>

PageModifiedDate

The last modified timestamp for the page.

Attributes:

  • format

    A string that provides the format in which to publish the date. If unspecified, the default that is appropriate for the language of the blog is used (for English, this is "%B %e, %Y %l:%M %p"). See the Date tag for the supported formats.

  • language

    Forces the date to the format associated with the specified language.

  • utc

    Forces the date to UTC format.

Example:

    <$mt:PageModifiedDate$>

PageMore

This tag outputs the contents of the page's Extended field.

If a text formatting filter has been specified it will automatically applied.

Attributes:

  • convert_breaks (optional)

    Controls the application of text formatting. By default convert_breaks is 0 (false). This should only be used if text formatting is set to "none" in the Entry/Page editor.

Example:

    <$mt:PageMore$>

PageNext

A container tag that create a context to the next page.

PagePermalink

An absolute URL pointing to the archive page containing this entry. An anchor (#) is included if the permalink is not pointing to an Individual Archive page.

Example:

    <$mt:PagePermalink$>

PagePrevious

A container tag that create a context to the previous page.

PagerBlock

A block tag iterates from 1 to the number of the last page in the search result. For example, if the limit was 10 and the number of results is 75, the tag loops from 1 through 8.

The page number is set to __value__ standard variable in each iteration.

The tag also sets __odd__, __even__, __first__, __last__ and __counter__ standard variables.

Example:

    M
    <MTPagerBlock>
      <MTIfCurrentPage>o<MTElse><a href="<MTPagerLink>">o</a></MTIfCurrentPage>
    </MTPagerBlock>
    vable Type

produces:

    "Mooooooooovable Type" where each "o" is a link to the page.

PagerLink

A function tag returns the URL points to the page in the context of PagerBlock. The tag can only be used in the context of PagerBlock.

Pages

A block tag which iterates over a list of published pages from a blog and outputs a selection of pages that are appropriate for the context used and the template being published.

<mt:Pages>
    <$mt:PageTitle$>
    <$mt:PageBody$>
</mt:Pages>

A pages is a class of entry, essentially non-date-based entries. Thus all attriutes of mt:Entries can also be used with mt:Pages.

Page-related tags can be used inside the mt:Pages loop block. Most page-related tags are alias’ of Entry-related tags, thus most can be used interchangeably.

In the same way folder is a class of category.

Attributes

All of the non entry-specific attributes of mt:Entries can be used with mt:Pages.

Attributes unique to mt:Pages:


folder

Filter the resulting pages by a particular folder. Use folder label (not folder basename) as the value. Similar to mt:Entries category

<mt:Pages folder="About Us">
    <$mt:PageLabel$>
</mt:Pages>

include_subfolders

Boolean value, 1 or 0 (default). If specified in conjunction with the folder attribute, pages assigned to subfolders of the identified folder/folders will be included in the set of pages. Similar to the include_subcategories in mt:Entries.

Specify ‘1’ to cause all pages that may exist within subfolders to the folder in context to be included.

Return pages in the folder “About Us” and any pages in subfolders of the “About Us” folder:

<mt:Pages folder="About Us" include_subfolders="1">
    <$mt:PageLabel$>
</mt:Pages>

no_folder

Returns all pages not associated to a folder.

List all pages not contained in a folder:

<mt:Pages no_folder="1">
    <!-- do something -->
</mt:Pages>

Example

See mt:Entries examples

Display the 10 most recent pages in the folder “Locations”:

<mt:Pages folder="Locations" lastn="10">
    <!-- do something -->
</mt:Pages>

Display the pages in the folder “Locations” sorted by title, listed in ascending order:

<mt:Pages folder="Locations" sort_by="title" sort_order="ascend">
    <!-- do something -->
</mt:Pages>

PagesFooter

The contents of this container tag will be displayed when the last page listed by a Pages tag is reached.

PagesHeader

The contents of this container tag will be displayed when the first page listed by a Pages tag is reached.

Example:

    <mt:Pages glue=", ">
        <mt:PagesHeader>
            The following pages are available:
        </mt:PagesHeader>
        <a href="<$mt:PagePermalink$>"><$mt:PageTitle$></a>
    </mt:Pages>

PageTags

A container tag which create a context about the assigned tags. Analogous to EntryTags.

Attributes:

  • glue

    A string used to join the output of the separate iterations of this tag.

Example:

Listing out the page's tags, separated by commas:

    <mt:PageTags glue=", "><$mt:TagName$></mt:PageTags>

PageTitle

The title of the page in context.

Example:

    <$mt:PageTitle$>

ParentCategories

A block tag that lists all the ancestors of the current category.

Output all parent categories and glue using a forward slash:

<mt:ParentCategories glue ="/">
    <$mt:CategoryLabel$>
</mt:ParentCategories>

Attributes

exclude_current

This optional boolean attribute controls the exclusion of the current category in the list.

glue

This optional attribute is a shortcut for connecting each category label with its value.

Examples

Breadcrumbs

Use the following code on Category archive template. If the current category has a parent category, loop through the parent categories starting at the top level (excluding the current category), then output the title of the current archive.

<mt:HasParentCategory>
    <mt:ParentCategories exclude_current="1">
        <a href="<$mt:CategoryArchiveLink$>"><$mt:CategoryLabel$></a> /
    </mt:ParentCategories>
</mt:HasParentCategory>
<$mt:ArchiveTitle$>

On an Entry archive template:

<mt:HasParentCategory>
    <mt:ParentCategories>
        <a href="<$mt:CategoryArchiveLink$>"><$mt:CategoryLabel$></a> /
    </mt:ParentCategories>
</mt:HasParentCategory>
<$mt:EntryTitle$>

ParentCategory

A container tag that creates a context to the current category’s parent, if category is assigned a parent category.

Example

List all the categories and link to parent category if category in context has a parent category:

<ul>
<mt:Categories>
    <li>
    <a href="<mt:ArchiveLink>"><mt:CategoryLabel></a>
    <mt:ParentCategory>
        (Parent Category: <a href="<mt:ArchiveLink>"><mt:CategoryLabel></a>)
    </mt:ParentCategory>
    </li>
</mt:Categories>
</ul>

block, category, template tag

ParentFolder

A container tag that creates a context to the current folder's parent.

Example:

    <mt:ParentFolder>
        Up: <a href="<mt:ArchiveLink>"><mt:FolderLabel></a>
    </mt:ParentFolder>

ParentFolders

A block tag that lists all the ancestors of the current folder.

Attributes:

  • glue

    This optional attribute is a shortcut for connecting each folder label with its value. Single and double quotes are not permitted in the string.

  • exclude_current

    This optional boolean attribute controls the exclusion of the current folder in the list.

PingBlogName

The site name that sent the TrackBack ping.

Example:

    <$mt:BlogName$>

PingDate

The timestamp of when the ping was submitted. Date format tags may be applied with the format attribute along with the language attribute.

Attributes:

  • format (optional)

    A string that provides the format in which to publish the date. If unspecified, the default that is appropriate for the language of the blog is used (for English, this is "%B %e, %Y %l:%M %p"). See the Date tag for the supported formats.

  • language (optional; defaults to blog language)

    Forces the date to the format associated with the specified language.

  • utc (optional; default "0")

    Forces the date to UTC time zone.

  • relative (optional; default "0")

    Produces a relative date (relative to current date and time). Suitable for dynamic publishing (for instance, from PHP or search result templates). If a relative date cannot be produced (the archive date is sufficiently old), the 'format' attribute will govern the output of the date.

Example:

    <$mt:PingDate$>

PingEntry

Provides an entry context for the parent entry of the TrackBack ping in context.

Example:

    Last TrackBack received was for the entry
    titled:
    <mt:Pings lastn="1">
        <mt:PingEntry>
            <$mt:EntryTitle$>
        </mt:PingEntry>
    </mt:Pings>

PingExcerpt

An excerpt describing the URL of the ping sent.

Example:

    <$mt:PingExcerpt$>

PingID

A numeric system ID of the TrackBack ping in context.

Example:

    <$mt:PingID$>

PingIP

The IP (Internet Protocol) network address the TrackBack ping was sent from.

Example:

    <$mt:PingIP$>

PingRank

A function tag which returns a number from 1 to 6 (by default) which represents the rating of the TrackBack ping in context in terms of total score where '1' is used for the highest score, '6' for the lowest score.

Attributes:

  • namespace (required)

    Specify namespace for rank to be calculated. Namespace is defined by each plugin which leverages rating API.

  • max (optional; default "6")

    Allows a user to specify the upper bound of the scale.

Example:

    <$mt:PingRank namespace="FiveStarRating"$>

Pings

A context-sensitive container tag that lists all of the pings sent to a particular entry, category or blog. If used in an entry context the tagset will list all pings for the entry. Likewise for a TrackBack-enabled category in context. If not in an entry or category context, a blog context is assumed and all associated pings are listed.

Attributes:

  • category

    This attribute creates a specific category context regardless of its placement.

  • lastn

    Display the last N pings in context. N is a positive integer.

  • sort_order

    Specifies the sort order. Recognized values are "ascend" (default) and "descend."

PingScore

A function tag that provides total score of the TrackBack ping in context. Scores grouped by namespace of a plugin are summed to calculate total score of a TrackBack ping.

Attributes:

  • namespace (required)

    Specify namespace for the score to be sorted. Namespace is defined by each plugin which leverages rating API.

Example:

    <$mt:PingScore namespace="FiveStarRating"$>

PingScoreAvg

A function tag that provides the avarage score of the TrackBack ping in context. Scores grouped by namespace of a plugin are summed to calculate total score of a TrackBack ping, and average is calculated by dividing the total score by the number of scorings or 'votes'.

Attributes:

  • namespace (required)

    Specify namespace for avarage score to be calculated. Namespace is defined by each plugin which leverages rating API.

Example:

    <$mt:PingScoreAvg namespace="FiveStarRating"$>

PingScoreCount

A function tag that provides the number of scorings or 'votes' made to the TrackBack ping in context. Scorings grouped by namespace of a plugin are summed.

Attributes:

  • namespace (required)

    Specify namespace for the number of scorings to be calculated. Namespace is defined by each plugin which leverages rating API.

Example:

    <$mt:PingScoreCount namespace="FiveStarRating"$>

PingScoreHigh

A function tag that provides the highest score of the TrackBack ping in context. Scorings grouped by namespace of a plugin are sorted to find the highest score of a TrackBack ping.

Attributes:

  • namespace (required)

    Specify namespace for the score to be sorted. Namespace is defined by each plugin which leverages rating API.

Example:

    <$mt:PingScoreHigh namespace="FiveStarRating"$>

PingScoreLow

A function tag that provides the lowest score of the TrackBack ping in context. Scorings grouped by namespace of a plugin are sorted to find the lowest score of a TrackBack ping.

Attributes:

  • namespace (required)

    Specify namespace for the score to be sorted. Namespace is defined by each plugin which leverages rating API.

Example:

    <$mt:PingScoreLow namespace="FiveStarRating"$>

PingsFooter

The contents of this container tag will be displayed when the last ping listed by a Pings tag is reached.

PingsHeader

The contents of this container tag will be displayed when the first ping listed by a Pings tag is reached.

PingsSent

A container tag representing a list of TrackBack pings sent from an entry. Use the PingsSentURL tag to display the URL pinged.

Example:

    <h4>Ping'd</h4>
    <ul>
    <mt:PingsSent>
        <li><$mt:PingsSentURL$></li>
    </mt:PingsSent>
    </ul>

PingsSentURL

The URL of the TrackBack ping was sent to. This is the TrackBack Ping URL and not a permalink.

Example:

    <$mt:PingsSentURL$>

PingTitle

The title of the remote resource that the TrackBack ping sent.

Example:

    <$mt:PingTitle$>

PingURL

The URL of the remote resource that the TrackBack ping sent.

Example:

    <$mt:PingURL$>

PreviousLink

A function tag returns the URL points to the previous page of the current page that is being rendered.

ProductName

The Movable Type edition in use.

Attributes:

  • version (optional; default "0")

    If specified, also outputs the version (same as Version).

Example:

    <$mt:ProductName$>

for the MTOS edition, this would output:

    Movable Type Open Source

ProfileServices

This tag is a part of the Action Streams plugin bundled with Movable Type 4.25 and higher.

This block template tag lists the services possible for user registration and display of content on their Movable Type author profile.

Example:

<mt:ProfileServices>
    <mt:If name="__first__">
        <ul>
    </mt:If>
        <li><mt:Var name="label"></li>
    <mt:If name="__last__">
        </ul>
    </mt:If>
</mt:ProfileServices>

Attributes:

  • extra (optional)

    If specified and true, only profile services implemented by other MT plugins besides Action Streams are listed.

You can use the following variables in mt:ProfileServices block tags:

<$mt:Var name="Variable Name"$>
<-->
Variable Name Output Sample
label The name of the service TypePad
type The type of service Vox ("vox"), TypePad ("typepad")
ident_label Label of the ID field of your Action Streams accounts Profile ID
ident_example Outputs a sample of the account name
ident_prefix Predetermined prefix for username you enter when adding a service account http://profile.typepad.com
ident_suffix Predetermined suffix for username you enter when adding a service account .vox.com
ident_hint Hint for username you enter when adding a service account

PublishCharset

The value of the PublishCharset directive in the system configuration.

Example:

    <$mt:PublishCharset$>

R

RemoteSignInLink

Outputs a link to the MT Comment script to allow signing in to a TypeKey configured blog. NOTE: This is deprecated in favor of SignInLink.

RemoteSignOutLink

Outputs a link to the MT Comment script to allow a user to sign out from a blog. NOTE: This tag is deprecated in favor of SignOutLink.

S

SearchIncludeBlogs

Used in the search result template to pass the IncludeBlogs parameters through from the search form keeping the context of any followup search the same as the initial search.

Example:

    <input type="hidden" name="IncludeBlogs" value="<$mt:SearchIncludeBlogs$>" />

SearchMaxResults

Returns the value of the SearchMaxResults or MaxResults configuration setting. Use SearchMaxResults because MaxResults is considered deprecated.

SearchResultCount

The number of results found across all of the blogs searched. This tag is only recognized in search templates.

Example:

    <$mt:SearchResultCount$>

SearchResults

A container tag that creates a list of search results. This tag creates an entry and blog context that all Entry* and Blog* tags can be used.

This tag is only recognized in search templates.

SearchResultsFooter

The content of this block tag is rendered when the item in context from search results are the last item of the result set. You can use the block to render closeing tags of a HTML element, for example.

This tag is only recognized in SearchResults block.

Example:

    <mt:SearchResultsFooter>
    <p>If you didn't find what you were looking for, you can also peruse
    the <a href="<mt:Link identifier="archive_index">">site archives</a>.</p>
    </mt:SearchResultsFooter>

SearchResultsHeader

The content of this block tag is rendered when the item in context from search results are the first item of the result set. You can use the block to render headings and titles of the result table, for example.

This tag is only recognized in SearchResults block.

Example:

    <mt:SearchResultsHeader>
    <h3>Look what we found!</h3>
    </mt:SearchResultsHeader>

SearchScript

Returns the value of the SearchScript configuration setting. The default for this setting if unassigned is "mt-search.cgi".

SearchString

An HTML-encoded search query. This tag is only recognized in search templates.

Example:

    <$mt:SearchString$>

SearchTemplateID

Returns the identifier of the search template (ie, "feed" or "nomorepizzaplease").

Example:

    <$mt:SearchTemplateID$>

Section

A utility block tag that is used to wrap content that can be cached, or merely manipulated by any of Movable Type's tag modifiers.

Attributes:

  • cache_prefix (optional)

    When specified, causes the contents of the section tag to be cached for some period of time. The 'period' attribute can specify the cache duration (in seconds), or will use the DashboardCachePeriod configuration setting as a default (this feature was initially added to support cacheable portions of the Movable Type Dashboard).

  • period (optional)

    A number in seconds defining the duration to cache the content produced by the tag. Use in combination with the 'cache_prefix' attribute.

  • by_blog (optional)

    When using the 'cache_prefix' attribute, specifying '1' for this attribute will cause the content to be cached on a per-blog basis (otherwise, the default is system-wide).

  • by_user (optional)

    When using the 'cache_prefix' attribute, specifying '1' for this attribute will cause the content to be cached on a per-user basis (otherwise, the default is system-wide).

  • html_tag (optional)

    If specified, causes the content of the tag to be enclosed in a the HTML tag identified. Example:

        <mt:Section html_tag="p">Lorem ipsum...</mt:Section>

    Which would output:

        <p>Lorem ipsum...</p>
  • id (optional)

    If specified in combination with the 'html_tag' attribute, this 'id' is added to the wrapping HTML tag.

SetHashVar

A block tag that is used for creating a hash template variable. A hash is a variable that stores many values. You can even nest SetHashVar tags so you can store hashes inside hashes for more complex structures.

Example:

    <mt:SetHashVar name="my_hash">
        <$mt:Var name="foo" value="bar"$>
        <$mt:Var name="fizzle" value="fozzle"$>
    </mt:SetHashVar>

Then later:

    foo is assigned: <$mt:Var name="my_hash{foo}"$>

SetVar

A function tag used to set the value of a template variable. 

For simply setting variables you can use the Var tag with a value attribute to assign template variables.

Attributes:

  • var or name

    Identifies the name of the template variable. See Var for more information on the format of this attribute.

  • value

    The value to assign to the variable.

  • op (optional)

    See the Var tag for more information about this attribute.

  • prepend (optional)

    If specified, places the contents at the front of any existing value for the template variable.

  • append (optional)

    If specified, places the contents at the end of any existing value for the template variable.


Related Tags:


SetVarBlock

A block tag used to set the value of a template variable. Note that you can also use the global 'setvar' modifier to achieve the same result as it can be applied to any MT tag.

Attributes:

  • var or name (required)

    Identifies the name of the template variable. See Var for more information on the format of this attribute.

  • op (optional)

    See the Var tag for more information about this attribute.

  • prepend (optional)

    If specified, places the contents at the front of any existing value for the template variable.

  • append (optional)

    If specified, places the contents at the end of any existing value for the template variable.


Related Tags:

SetVars

A block tag that is useful for assigning multiple template variables at once.

Example:

    <mt:SetVars>
    title=My Favorite Color
    color=Blue
    </mt:SetVars>

Then later:

    <h1><$mt:Var name="title"$></h1>

<ul><li><$mt:Var name="color"$></li></ul>

Related Tags:


SetVarTemplate

Similar to the SetVarBlock tag, but does not evaluate the contents of the tag, but saves it for later evaluation, when the variable is requested. This allows you to create inline template modules that you can use over and over again.

Attributes:

  • var or name (required)

    Identifies the name of the template variable. See Var for more information on the format of this attribute.

Example:

    <mt:SetVarTemplate name="entry_title">
<h1><$MTEntryTitle$></h1>
</mt:SetVarTemplate>

<mt:Entries>
<$mt:Var name="entry_title"$>
</mt:Entries>

Related Tags:


SignInLink

Outputs a link to the MT Comment script to allow a user to sign in to comment on the blog.

SignOnURL

The value of the SignOnURL configuration setting.

SignOutLink

Outputs a link to the MT Comment script to allow a signed-in user to sign out from the blog.

SmartyPantsVersion

Type: function

Example

<mt:SmartyPantsVersion />

StaticFilePath

The file path to the directory where Movable Type's static files are stored (as configured by the StaticFilePath setting, or based on the location of the MT application files alone). This value is guaranteed to end with a "/" character.

StaticWebPath

The value of the StaticWebPath configuration setting. If this setting has no domain, the blog domain is added to it. This value is guaranteed to end with a "/" character.

Example:

    <img src="<$mt:StaticWebPath$>images/powered.gif"
        alt="Powered by MT" />

StreamAction

This tag is a part of the Action Streams plugin bundled with Movable Type 4.25 and higher.

Provides the recipe authors' suggested markup for the action in context.

Example:

<mt:ActionStreams lastn="10">
    <li><mt:StreamAction></li>
</mt:ActionStreams>

Attributes:

  • name (optional)

    The name of the author whose action this is. If not given, the author's profile display name is used. Note that by specifying an empty name (that is, name=""), the name will be omitted from the StreamAction result.

    <mt:ActionStreams limit="10">
        <li>
            <mt:Include module="Userpic">
            <a href="/profile/<mt:AuthorName dirify="1">">
                <mt:AuthorDisplayName escape="html">
            </a>
            <mt:StreamAction name="">
        </li>
    </mt:ActionStreams>
    

StreamActionDate

This functional template tag outputs the date of the action.

This is a part of the ActionStreams plugin and MT 4.25

 
Example:
<mt:ActionStreams>
<mt:DateHeader>
<div>
<h3><$mt:StreamActionDate format="%b %d, %Y"$></h3>
<ul>
</mt:DateHeader>
<li class="service-<$mt:var name="service_type"$>"><mt:StreamActionDate format="%H:%M"> - <$MTStreamAction$></li>
<mt:DateFooter>
</ul>
</div>
</mt:DateFooter>
</mt:ActionStreams>

Modifier
You can use the same modifiers with this tag as those used with the <mt:Date> function tag.

StreamActionID

This functional template tag outputs action IDs. It's a part of the ActionStreams plugin for use with MT 4.25.

Example:

<mt:ActionStreams>
<mt:DateHeader>
<div>
<h3><$mt:StreamActionDate format="%b %d, %Y"$></h3>
<ul>
</mt:DateHeader>
<li id="action-<$mt:StreamActionID$>" class="service-<$mt:var name="service_type"$>"><mt:StreamActionDate format="%H:%M"></abbr> - <$MTStreamAction$></li>
<mt:DateFooter>
</ul>
</div>
</mt:DateFooter>
</mt:ActionStreams>

StreamActionModifiedDate

This functional template tag outputs the date an action was modified.   It is a part of the ActionStreams plugin for use with MT 4.25.

For example, the tag for when an entry was submitted to Vox is <mt:StreamActionDate>. The date the entry received a comment or was updated is output as <mt:StreamActionModifiedDate>.

Example:
<mt:ActionStreams lastn="15">
<mt:If name="__first__">
<div class="widget-recent-action widget-recent widget">
<h3 class="widget-header">15 recent actions</a></h3>
<div class="widget-content">
<ul>
</mt:If>
<li class="service-<$mt:var name="service_type"$>"><mt:StreamActionModifiedDate format="%H:%M"> - <a href="<$mt:StreamActionURL$>"><$mt:StreamActionTitle$></a></li>
<mt:If name="__last__">
</ul>
</div>
</div>
</mt:If>

</mt:ActionStreams>
Modifier

The modifiers compatible with this tag are the same as those compatible with the <mt:Date> function tag. 

StreamActionRollup

This block template tag is for outputting actions in groups according to special rules.   It is a part of the ActionStreams plugin in MT 4.25.


Example
 
<mt:ActionStreams lastn="30">
<mt:If name="__first__">
<ul>
</mt:If>

<mt:StreamActionRollup by="stream">
<mt:If name="__first__">
<li><mt:StreamActionDate format_name="iso8601">l - <$mt:AuthorDisplayName escape="html"$> saved
<mt:Else name="__last__">
<mt:Ignore>If there are more than 3 actions, use 『A, B and C』display</mt:Ignore>
and
<mt:Else>
<mt:Ignore>If there are more than 3 actions, use 『A, B and C』display</mt:Ignore>
,
</mt:If>
<a href="<mt:StreamActionURL escape="html">"><$mt:StreamActionTitle escape="html"$></a>
<mt:If name="__last__">
</li>
</mt:If>

<mt:Else>
<mt:Ignore>use this template to deal with actions that can't be organized</mt:Ignore>
<li><mt:StreamActionDate format_name="iso8601"> - <$mt:StreamAction$></li>

</mt:StreamActionRollup>

<mt:If name="__last__">
</ul>
</mt:If>

</mt:ActionStreams>


Modifiers

  • by="date | service | stream | action"

Sets which actions to treat the same. Actions are outputted according to these settings.
  • date: Arranges outputted actions by date.
  • service: Arranges outputted actions by service. Helps organize identical services that run for more than a day.
  • stream: Arranges actions by type (like post, photo, link, etc). Helps organize identical actions that run for more than a day.
  • action: This is the same as setting both service and stream.
Default settings are date, action.


  • glue="foo"

    You can decide which character to use to separate two actions when organizing outputted actions.

StreamActionTags

When an action has tags, this block tag outputs a summary of those tags.

StreamActionThumbnailURL

This functional template tag outputs thumbnails for photos and movies in an action.  Not all services are compatible and items from incompatible services will not be output.

This template tag is a part of ActionStreams and MT 4.25 and above.

Example:
<mt:ActionStreams>
<mt:DateHeader>
<div>
<h3><$mt:StreamActionDate format="%b %d, %Y"$></h3>
<ul>
</mt:DateHeader>
<li class="service-<$mt:var name="service_type"$>">
<mt:StreamActionDate format="%H:%M"> - <$MTStreamAction$>
<mt:If tag="StreamActionThumbnailURL">
<div class="picture">
<img alt="<$mt:StreamActionTitle$> Image Title" src="<$mt:StreamActionThumbnailURL$>"/>
</div>
</mt:If>
</li>
<mt:DateFooter>
</ul>
</div>
</mt:DateFooter>
</mt:ActionStreams>
 

StreamActionTitle

This functional template tag outputs an action's title.

This tag is a part of ActionStreams and MT 4.25.

Example:
<mt:ActionStreams lastn="15">
<mt:If name="__first__">
<div class="widget-recent-action widget-recent widget">
<h3 class="widget-header">15 recent actions</a></h3>
<div class="widget-content">
<ul>
</mt:If>
<li class="service-<$mt:var name="service_type"$>"><a href="<$mt:StreamActionVia$>"><$mt:StreamActionTitle$></a></li>
<mt:If name="__last__">
</ul>
</div>
</div>
</mt:If>
</mt:ActionStreams>

StreamActionURL

This tag is a part of the Action Streams plugin bundled with Movable Type 4.25 and higher.

Provides the URL of the web asset associated with the current stream action.

Example:

<mt:ActionStreams lastn="10">
    <li>
        <a href="<mt:StreamActionURL escape="html">"><mt:StreamActionTitle></a>
    </li>
</mt:ActionStreams>

StreamActionVar

This Template Tag assigns parameters to refer to each variable that corresponds to an action. Use this to output items other than titles and URLs when using plugins to expand services.

This is a part of the ActionStreams plugin that comes with MT 4.25.

Example:
<mt:ActionStreams lastn="15">
<mt:If name="__first__">
<div class="widget-recent-action widget-recent widget">
<h3 class="widget-header">15 recent actions</a></h3>
<div class="widget-content">
<ul>
</mt:If>
<li class="service-<$mt:var name="service_type"$>"><a href="<$mt:StreamActionVar name="url"$>"><$mt:StreamActionVar name="title"$></a></li>
<mt:If name="__last__">
</ul>
</div>
</div>
</mt:If>
</mt:ActionStreams>

Default Usage:
<$mt:StreamActionVar name="parameter"$>


Possible Parameters
  • <$mt:StreamActionVar name="title">

    Outputs an action's title. The content is the same as that of the <mt:StreamActionTitle> functional tag.

  • <$mt:StreamActionVar name="url">

    Outputs the URL for a page with the details of the action

SubCategories

A specialized version of the mt:Categories block tag that respects the hierarchical structure of categories.

<mt:SubCategories top="1">
    <!-- do something -->
</mt:SubCategories>

Attributes

Use of either top or category attribute is required.

Bug: As of MT4.261: mt:SubCategories outputs nothing by default Case 100897

category

Specifies a specific category by name for which to return categories.

<mt:SubCategories category="Italian">
    <!-- do something -->
</mt:SubCategories>

If two categories have the same label (“Italian” in this case), they can be specified by listing their parent category label followed by the cateory name, separated by a slash:

<mt:SubCategories category="Restaurants/Italian">
    <!-- do something -->
</mt:SubCategories>
<mt:SubCategories category="Recipes/Italian">
    <!-- do something -->
</mt:SubCategories>

If category label contains a slash (such as “Indian/Pakistani”) surround the value with square brackets:

<mt:SubCategories category="Restaurants/[Indian/Pakistani]">
    <!-- do something -->
</mt:SubCategories>

Either top or category is required.

include_current

A boolean attribute controling inclusion of the current category specified in the category attribute in the list.

Bug: As of MT4.261: mt:SubCategories attribute include_current doesn’t “include” current, rather it limits. Case 100896

sort_method

An advanced usage attribute. A fully qualified Perl method name to be used to sort the categories.

<mt:SubCategories sort_method="Your::Perl::Package::sort_by_entry_count">
    <!-- do something -->
</mt:SubCategories>

sort_order

Specifies the sort order of the category labels. Values “ascend” (default) and “descend”. This attribute is ignored if sort_method has been set.

Display a reversed list of top-level categories:

<mt:SubCategories top="1" sort_order="descend">
    <!-- do something -->
</mt:SubCategories>

top

If set to 1, displays only top level categories. Same as using TopLevelCategories.

List of top-level categories:

<mt:SubCategories top="1">
    <!-- do something -->
</mt:SubCategories>

Examples

Subcategories

List the subcategories of “Category AAA”

<ul>
<mt:SubCategories category="Cat AAA">
    <li><a href="<$MTCategoryArchiveLink$>"><$MTCategoryLabel$></a></li>
</mt:SubCategories>
</ul>

Recursive Category List

Recursively list all categories starting with top-level categories, only linking categories that contain entries (using mt:CategoryCount). (Using mt:SubCatIsFirst and mt:SubCatIsLast to condition for the first and last loops respectively):

<mt:SubCategories top="1">
    <mt:SubCatIsFirst>
        <ul>
    </mt:SubCatIsFirst>
    <mt:If tag="CategoryCount">
            <li>
                <a href="<$mt:CategoryArchiveLink$>" title="<$mt:CategoryDescription$>"><mt:CategoryLabel></a>
    <mt:Else>
            <li>
                <$mt:CategoryLabel$>
    </mt:If>
    <$mt:SubCatsRecurse$>
    </li>
    <mt:SubCatIsLast>
        </ul>
    </mt:SubCatIsLast>
</mt:SubCategories>

Display Parent, Sibling and Child Categories

Modify the following for your specific use case.

Use the following mtml on a Category archive to list related categories. List parent and child categories of the current category. If current category has a parent category, then return the parent category and any sub categories. If the current category does not have a parent category then just display subcategories…

<$mt:CategoryLabel setvar="CategoryLabel"$>
<mt:HasParentCategory>
    <mt:ParentCategory>
        <$mt:CategoryLabel setvar="ParentCategoryLabel"$>
        <li>Parent: <a href="<$mt:ArchiveLink$>"><$mt:CategoryLabel$></a></li>
        <mt:SubCategories category="$ParentCategoryLabel">
            <mt:If tag="CategoryLabel" ne="$ParentCategoryLabel">
                <li>Sibling: <a href="<$mt:CategoryArchiveLink$>"><$mt:CategoryLabel$></a></li>
            </mt:If>
        </mt:SubCategories>
        <li>Current: <$mt:Var name="CategoryLabel"$></li>
        <mt:SubCategories category="$CategoryLabel">
            <mt:If tag="CategoryLabel" ne="$CategoryLabel">
                <li>Child: <a href="<$mt:CategoryArchiveLink$>"><$mt:CategoryLabel$></a></li>
            </mt:If>
        </mt:SubCategories>
    </mt:ParentCategory>
<mt:Else>
    <mt:SubCategories top="1">
        <li>Sibling: <a href="<$mt:CategoryArchiveLink$>"><$mt:CategoryLabel$></a></li>
    </mt:SubCategories>
        <li>Current: <$mt:Var name="CategoryLabel"$></li>
    <mt:SubCategories category="$CategoryLabel">
        <li>Child: <a href="<$mt:CategoryArchiveLink$>"><$mt:CategoryLabel$></a></li>
    </mt:SubCategories>
</mt:HasParentCategory>

Related

SubCategoryPath

The path to the category relative to mt:BlogURL. In other words, this tag returns a string that is a concatenation of the basenames of the current category and its ancestors seprated with slashes.

Examples

For the following category hierarchy:

  • Foo
    • Bar
      • Baz

And the following mtml:

<mt:Categories>
    The sub-category path for <$mt:CategoryLabel$> is: <$mt:SubCategoryPath$>
</mt:Categories>

The output for the category “Baz” would be:

The sub-category path for Baz is: foo/bar/baz

This tag is provided for convenience and is the equivalent of this combination of mt:ParentCategories and mt:CategoryBasename:

<mt:ParentCategories glue="/"><$mt:CategoryBasename$></mt:ParentCategories>

SubCatIsFirst

The contents of this container tag will be displayed when the first category listed by a mt:SubCategories loop tag is reached.

<mt:SubCategories>
    <mt:SubCatIsFirst>
        <!-- do something -->
    <mt:else>
        <!-- do something else -->
    </mt:SubCatIsFirst>
</mt:SubCategories>

Use mt:SubCatIsLast for conditioning content at the end of the loop.

Examples

See mt:SubCategories loop tag for more examples.

SubCatIsLast

The contents of this container tag will be displayed when the last category listed by a mt:SubCategories loop tag is reached.

<mt:SubCategories>
    <mt:SubCatIsLast>
        <!-- do something -->
    <mt:else>
        <!-- do something else -->
    </mt:SubCatIsLast>
</mt:SubCategories>

Use mt:SubCatIsFirst for conditioning content at the beginning of the loop.

Examples

See mt:SubCategories loop tag for more examples.

block, categories, category, conditional, last

SubCatsRecurse

Recursively call the SubCategories or TopLevelCategories container with the subcategories of the category in context.

<mt:TopLevelCategories>
    <$mt:CategoryLabel$>
    <$mt:SubCatsRecurse$>
</mt:TopLevelCategories>

This tag, when placed at the end of loop controlled by one of the tags above will cause them to recursively descend into any subcategories that exist during the loop.

Attributes

max_depth

An optional attribute that specifies the maximum number of times the system should recurse. The default is infinite depth.

Examples

The following code prints out a recursive list of categories/subcategories, linking those with entries assigned to their category archive pages.

<mt:TopLevelCategories>
    <mt:SubCatIsFirst>
        <ul>
    </mt:SubCatIsFirst>
    <mt:If tag="CategoryCount">
            <li><a href="<$mt:CategoryArchiveLink$>" title="<$mt:CategoryDescription$>"><$mt:CategoryLabel$></a>
    <mt:Else>
            <li><$mt:CategoryLabel$>
    </mt:If>
    <$mt:SubCatsRecurse$>
            </li>
    <mt:SubCatIsLast>
        </ul>
    </mt:SubCatIsLast>
</mt:TopLevelCategories>

Related

SubFolderRecurse

Recursively call the <mt:SubFolders> or <mt:TopLevelFolders> container with the subfolders of the folder in context. This tag, when placed at the end of loop controlled by one of the tags above will cause them to recursively descend into any subfolders that exist during the loop.

<mt:TopLevelFolders>
  <$mt:FolderLabel$>
  <$mt:SubFolderRecurse$>
</mt:TopLevelFolders>

Because folders are essentially categories for pages, most of the mtml category tags also work for folders.

Attributes

max_depth

Specifies the maximum number of times the system should recurse. Default is infinite depth.

Examples

Create recursive list of folders/subfolders, linking those with pages to the respective directory.

Note: Because folders don’t have archive templates, there is no <$mt:FolderArchiveLink$> because there is no guarantee that a page with the basename of index exists in the folder. Thus linking to the folder must be created manually using “<$mt:BlogURL$><$mt:FolderPath$>/”.

<mt:TopLevelFolders>
    <mt:SubCatIsFirst><ul></mt:SubCatIsFirst>
        <mt:If tag="FolderCount">
            <li><h3><a href="<$mt:BlogURL$><$mt:FolderPath$>/"
            title="<$mt:FolderDescription$>"><mt:FolderLabel></a> (<$mt:FolderCount$>)</h3>
        <mt:Else>
            <li><h3><$mt:FolderLabel$> (<$mt:FolderCount$>)</h3>
        </mt:If>
        <$mt:SubFolderRecurse$>
        </li>
    <mt:SubCatIsLast></ul></mt:SubCatIsLast>
</mt:TopLevelFolders>

Same as above example but now listing pages in each folder, recursively.

<mt:TopLevelFolders>
    <mt:SubCatIsFirst><ul></mt:SubCatIsFirst>
        <mt:If tag="FolderCount">
            <li><h3><a href="<$mt:BlogURL$><$mt:FolderPath$>/"
            title="<$mt:FolderDescription$>"><mt:FolderLabel></a> (<$mt:FolderCount$>)</h3>
        <mt:Else>
            <li><h3><$mt:FolderLabel$> (<$mt:FolderCount$>)</h3>
        </mt:If>
        <mt:Pages>
            <mt:If name="__first__"><ul></mt:If>
                <li><a href="<$mt:PagePermalink$>"><$mt:PageTitle$></a></li>
            <mt:If name="__last__"></ul></mt:If>
        </mt:Pages>
        <$mt:SubFolderRecurse$>
        </li>
    <mt:SubCatIsLast></ul></mt:SubCatIsLast>
</mt:TopLevelFolders>

Related

SubFolders

A specialized version of the Folders container tag that respects the hierarchical structure of folders.

Attributes:

  • include_current

    An optional boolean attribute that controls the inclusion of the current folder in the list.

  • sort_method

    An optional and advanced usage attribute. A fully qualified Perl method name to be used to sort the folders.

  • sort_order

    Specifies the sort order of the folder labels. Recognized values are "ascend" and "descend." The default is "ascend." This attribute is ignored if sort_method is unspecified.

  • top

    If set to 1, displays only top level folders. Same as using TopLevelFolders.

T

TagCount

Returns the number of entries that have been tagged with the current tag in context.

TagID

Outputs the numeric ID of the tag currently in context.

TagLabel

An alias for the 'TagName' tag.

TagName

Outputs the name of the current tag in context.

Attributes:

  • normalize (optional; default "0")

    If specified, outputs the "normalized" form of the tag. A normalized tag has been stripped of any spaces and punctuation and is only lowercase.

    • quote (optional; default "0")

      If specified, causes any tag with spaces in it to be wrapped in quote marks.

TagRank

A variable tag which returns a number from 1 to 6 (by default) which represents the rating of the entry tag in context in terms of usage where '1' is used for the most often used tags, '6' for the least often. The tag context is created by either an EntryTags or an Tags block.

This is suitable for creating "tag clouds" in which TagRank can determine what level of header (h1 - h6) to apply to the tag.

Attributes:

  • max (optional; default "6")

    Allows a user to specify the upper bound of the scale.

The following is a very basic tag cloud suitable for an index template or, with some styling, a sidebar of any page.

    <h1>Tag cloud</h1>
    <div id="tagcloud">
        <mt:Tags>
            <h<$mt:TagRank$>>
                <a href="<$mt:TagSearchLink$>"><$mt:TagName$></a>
            </h<$mt:TagRank$>>
        </mt:Tags>
    </div>

Tags

A container tags used for listing all previously assigned entry tags for the blog in context.

Attributes:

  • glue

    A text string that is used to join each of the items together. For example

        <mt:Tags glue=", "><$mt:TagName$></mt:Tags>

    would print out each tag name separated by a comma and a space.

  • type

    The kind of object for which to show tags. By default the entry tags are shown.

  • sort_by

    The tag object column on which to order the tags. Common values are name and rank. By default tags are sorted by name.

  • sort_order

    The direction in which to sort tags by the sort_by field. Possible values are ascend and descend. By default, tags are shown in ascending order when sorted by name and descending order when sorted by other columns.

  • limit

    A number of tags to show. If given, only the first tags as ordered by sort_by and sort_order are shown.

  • top

    A number of tags to show. If given, only the given number of tags with the most uses are shown. For example:

        <mt:Tags top="20">
            <$mt:TagName$>
        </mt:Tags>

    is equivalent to

        <mt:Tags limit="20" sort_by="rank">
            <$mt:TagName$>
        </mt:Tags>

    Note that even when top is used, the tags are shown in the order specified with sort_by and sort_order.

The following code is functional on any template. It prints a simple list of tags for a blog, each linked to a tag search.

    <ul>
        <mt:Tags>
        <li>
            <a href="<$mt:TagSearchLink$>"><$mt:TagName$></a>
        </li>
        </mt:Tags>
    </ul>

Using tags like TagRank and TagCount and proper page styling, you can make this simple code into a powerful looking and useful "tag cloud".

    <ul>
        <mt:Tags top="20">
        <li class="rank-<$mt:TagRank max="10"$> widget-list-item">
            <a href="<$mt:TagSearchLink$>"><$mt:TagName$></a>
        </li>
        </mt:Tags>
    </ul>

TagSearchLink

A variable tag that outputs a link to a tag search for the entry tag in context. The tag context is created by either an EntryTags or a Tags block.

Like all variable tags, you can apply any of the supported global modifiers to TagSearchLink to do further transformations.

The example below shows each tag in a cloud tag linked to a search for other entries with that tag assigned. It can just as easily be used to link entry tags within an EntryTags loop

    <h1>Tag cloud</h1>
    <div id="tagcloud">
        <mt:Tags>
            <h<$mt:TagRank$>>
                <a href="<$mt:TagSearchLink$>"><$mt:TagName$></a>
            </h<$mt:TagRank$>>
        </mt:Tags>
    </div>

The search link will look something like:

    http://example.com/mt/mt-search.cgi?blog_id=1&tag=politics

Using Apache rewriting, the search URL can be cleaned up to look something like:

    http://example.com/tag/politics

A URL like this would have to be built like this:

    <$mt:BlogURL$>tag/<$mt:TagName normalize="1"$>

And of course, you would have to create the .htaccess rules to translate this into a request to mt-search.cgi.

Template Tags by Type

There are many different types of template tags in Movable Type, and each type describes a different kind of information that you might want to publish on your site. Here, we've grouped almost all of the available tags into a small number of types so that you can find them based on the kind of information you'd like to display.


There's a full alphabetical list of tags, as well.

Archives: Archive tags let you output lists of archives, create links to them, and provide titles and other information about archive listings.

Assets: You can publish any asset in Movable Type's asset management system using asset template tags, along with the asset's score, any tags describing the asset, and metadata like its title, description, and size.

Authors: There are template tags to output all information about authors on your system, either in a system-wide context or for publishing information about the author of an individual entry or page.

Blogs: Blog template tags offer fundamental information about your blog's configuration, and some options for multi-blog aggregation.

Calendars: If you'd like to include a calendar-style listing of your blog content, calendar template tags will do the trick.

Categories: Category template tags are handy both for publishing lists of categories that you use on your site as well as outputting information about the categories that an individual entry belongs to.

Comments and TrackBacks: All of the feedback on your site can be published using comment and TrackBack tags, along with conditional tags to change what's published depending on your comment settings.

Counts: There are lots of different items in MT that you might want to count and display on your blog -- assets, entries, pages and more. Counting template tags let you do exactly that.

Creative Commons: Movable Type was the first platform to integrate Creative Commons license options right into the tool, and the CC template tags let you publish machine-readable versions of those licenses on your site.

Date and Time: Movable Type manages many dates and times, for events such as when your content is created or updated, and these can all be published using date and time template tags.

Entries: Entries are the heart of MT's publishing system, so there are lots and lots of template tags for outputting every single aspect of entries, along with their associated data and information like categories and tags.

Feeds: Feeds are a mysterious mistress -- best not to tread where these template tags will lead you!

Folders: MT's folder management system works hand-in-hand with its asset management, and folder tags let you link to folders and display information about them.

IDs: Every object in Movable Type, from entries to authors to assets, has its own unique system ID, generated by your database. You can do fancy tricks with these IDs, or just use them to reference objects, all by using ID template tags.

Logic: Get yer Spock on with logic template tags -- all of the ifs, thens, elses, unlesses, and fors you need to do some serious programming-style templates. Logic tags also let you set up parts of your template that publish based on the content or settings of your blog.

Pages: Just like with entries, pages form the heart of what you can publish with MT, and the pages template tags provide access to all the information that makes up a page.

Search: Search template tags are perfect for customizing your search results to appear exactly the way you want them to.

Tags: This might seem a little tricky -- you can use template tags to publish the Tags you use on your entries and pages. Don't worry, you'll get the hang of it. And you can even do fancy stuff like tag clouds.

App: App template tags are used by the MT administration screens. You probably won't need (or want!) to mess with these unless you're customizing the application itself.

System: System template tags offer some insights into broad, system-wide settings for your MT install. A few of these are handy for setting defaults in your published templates, or for outputting the location of the various scripts that make your MT install run.

Archives

Assets

Authors

Blogs

Calendars

Categories

Comments and TrackBacks

Counts

Creative Commons

Date and Time

Entries

Feeds

Folders

IDs

Logic Tags (If/Then/Else)

Pages

Tags

Variables

App

System

TemplateCreatedOn

Returns the creation date for the template publishing the current file.

Example:

    <$mt:TemplateCreatedOn$>

TemplateNote

A function tag that always returns an empty string. This tag is useful for placing simple notes in your templates, since it produces nothing.

Example:

    <$mt:TemplateNote note="Hi, mom!"$>

Textile

Type: block

Example

<mt:Textile>
  <!-- do something -->
</mt:Textile>

TextileHeadOffset

Type: function

Provides a way to offset the .h1, .h2, etc. Textile header blocks. This is useful if you always write your entries using "h1.", "h2." blocks, but need these to be published with "<h3>", "<h4>" tags instead (depending on the structure of the document being published).

Attributes

  • offset: A number that used to offset the published heading tags. If set to 1, each "h1" block is published in a "<h2>" tag, "h2" is published as "<h3>", and so forth.

Example

<$mt:TextileHeadOffset offset="2"$>

TextileOptions

Type: function

Example

<mt:TextileOptions />

TopLevelCategories

A block tag listing the categories which exist at “the top” of the category hierarchy; categories which do not have a parent category.

<mt:TopLevelCategories>
    <mt:CategoryLabel>
</mt:TopLevelCategories>

Same as using <mt:SubCategories top="1">.

See mt:SubCategories for details.

TopLevelFolder

A container tag that creates a context to the top-level ancestor of the current folder.

TopLevelFolders

A block tag listing the folders that do not have a parent and exist at “the top” of the folder hierarchy. Same as using <mt:SubFolders top="1">.

Examples

Basic listing of the top level folders:

<mt:TopLevelFolders>
    <!-- do something -->
    <$mt:FolderLabel$>
</mt:TopLevelFolders>

See more examples in the <$mt:SubFolderRecurse$> tag docs.

Related

TopLevelParent

A container tag that creates a context to the top-level ancestor of the current category.

TotalPages

A function tag returns a number represents the total number of pages in the current search context. The number starts from 1.

TrackbackScript

Returns the value of the TrackbackScript configuration setting. The default for this setting if unassigned is "mt-tb.cgi".

TypeKeyToken

Outputs the configured TypeKey token for the current blog in context. If the blog has not been configured to use TypeKey, this will output an empty string.

U

Unless

A conditional tag that is the logical opposite of the If tag. All attributes supported by the If tag are also supported for this tag.

UserSessionCookieDomain

Returns the value of the UserSessionCookieDomain configuration setting, or the domain name of the blog currently in context. Any "www" subdomain will be ignored (ie, "www.sixapart.com" becomes ".sixapart.com").

The UserSessionCookieDomain may also use MT tags. If it does, they will be evaluated for the blog in context.

UserSessionCookieName

Returns the value of the UserSessionCookieName configuration setting. If the setting contains the %b string, it will replaced with the blog ID of the blog currently in context.

Example:

    <$mt:UserSessionCookieName$>

UserSessionCookiePath

Returns the value of the UserSessionCookiePath configuration setting.

The UserSessionCookiePath may also use MT tags. If it does, they will be evaluated for the blog in context.

UserSessionCookieTimeout

Returns the value of the UserSessionCookieTimeout configuration setting.

UserSessionState

Returns a JSON-formatted data structure that represents the user that is currently logged in.

This tag is usually only used in the context of system templates. The blog accesses this data once per user session via javascript. See the JavaScript index template from the default template set for an example of this.

Example

The tag <$mt:UserSessionState$> will output the following JSON data structure (formatted with whitespace for readability):

{
    "sid":"Hk8lPRoJ1FBuxnQrdZUUvC8qHo9ngmgyNDEKLIkW",
    "userpic":"/mt-static/support/assets_c/userpics/userpic-1-100x100.png",
    "profile":"",
    "auth_type":1,
    "is_trusted":1,
    "is_anonymous":0,
    "name":"Melody P Nelson",
    "email":"melody@sixapart.com",
    "is_author":1,
    "is_banned":0,
    "is_authenticated":1,
    "can_comment":1,
    "can_post":1,
    "url":"http://sixapart.com"
}

V

Var

A function tag used to store (like the <mt:SetVar> tag) and return values from variables.

This tag is one of the most useful tags when digging deeper into creating templates with Movable Type.

Basic Example

  1. Set a variable (no output when setting the value of a variable):

    <$mt:Var name="foo" value="bar"$>
    
  2. later in the code, output the value of the variable:

    <$mt:Var name="foo"$>
    

    Output:

    bar
    

Tip: Use the <mt:SetVarBlock> tag to store the output of a set of template tags in a variable:

<mt:SetVarBlock name="entry_ids">
    <mt:Entries glue=","><$mt:EntryID$></mt:Entries>
</mt:SetVarBlock>

Variables as attribute values

<$mt:Var name="latest_entries" value="10"$>
The most recent <$mt:Var name="latest_entries"$> entries:
<ul>
<mt:Entries lastn="$latest_entries">
    <li><a href="<$mt:EntryPermalink$>"><$mt:EntryTitle$></a></li>
</mt:Entries>
<ul>

Tip: Use the setvar modifier to set the value of a variable rather than output the value:

<$mt:BlogID setvar="foo"$>

Attributes

Note: Support for various attributes depends on the version of Movable Type.

The most common attributes are in bold.

append

Used to append a value to the end of an existing variable. Opposite of prepend.

Values 1 and 0 (default).

<$mt:Var name="foo" value="bar"$>
<$mt:Var name="foo" value="baz" append="1"$>
<$mt:Var name="foo"$>

Output:

barbaz

default

A value returned when the variable’s value is a empty string or not defined.

<$mt:Var name="foo" default="bar"$>

A value of “0” does not trigger the default attribute. Use a conditional such as <mt:If> or <mt:Unless> tag instead:

<$mt:Var name="foo" value="0"$>
<mt:If name="foo">
    foo is a non-zero value.
<mt:Else>
    foo is zero or another empty string.
</mt:If>

function

The function attribute supports diffent values for array and hash variables.

For array variables:

  • count - Returns the number of elements in the array template variable.
  • pop - Takes an element from the end of the array (last element).
  • push - Adds an element onto the end of the array.
  • shift - Takes an element from the front of the array (index 0). Only works with mt:GetVar.
  • unshift - Adds the element to the front of the array (index 0).
  • glue - value used to join the values of an array together.
  • index - Identifies an element of an array template variable.

For hash variables:

  • count - Returns the number of keys present in the hash template variable.
  • default - If the variable is undefined or empty, this value will be output instead.
  • delete - Only valid when used with the ‘key’ attribute, or if a key is present in the variable name.
  • key - Identifies a key of a hash template variable.
  • to_json - Formats the variable in JSON notation.

See examples for array and hash variables below.

name

Required attribute identifying the template variable to be assigned or displayed.

The name attribute value should be a string made up of only alphanumeric characters and underscores (“_”) in order to not conflict with variable interpolation. Curly brackets (“{ }” may be used for specifying hash values see <mt:SetHashVar>).

It’s best practice to keep variable names as simple, short and memorable as possible. (Note: prior to Movable Type 4, variable names were less constrained, but invalid characters such as spaces and symbols in particular are unsupported.)

Template variables may also be arrays or hash variables, in which case you may want to reference a specific element instead of the array or hash itself.

This selects the second element from the ‘foo’ array variable:

<$mt:Var name="foo[1]"$>

This selects the ‘bar’ element from the ‘foo’ hash variable:

<$mt:Var name="foo{bar}"$>

Sometimes you want to obtain the value of a function that is applied to a variable (see the function attribute). This will obtain the number of elements in the ‘foo’ array variable:

<$mt:Var name="count(foo)"$>

op

Allows the application of a number of mathematical operators to the value of the variable.

Note: when using the op attribute, the value attribute is used to define the second operand instead of to set the value of the variable. If the calculated value of the operation needs to be stored, use the setvar attribute.

Examples:

<$mt:Var name="days" value="10"$> (set the value of the variable using "value". The [`<mt:SetVar>`](/tags/setvar) tag could also be used here.)
<$mt:Var name="days"$> ($days = 10)
<$mt:Var name="days" op="/" value="2"$> ($days divide by 2 = 5)
<$mt:Var name="days" op="*" value="3" setvar="days_multiplied_by_three"$> ($days multiplied by 3 = 30 stored in a new variable using "setvar")
<$mt:Var name="days_multiplied_by_three"$> ($days_multiplied_by_three = 30)
<$mt:Var name="days" op="+" value="1" setvar="days"$> ($days plus 1 = 11 used to update the value of the "days" variable using "setvar")
<$mt:Var name="days" op="%" value="3"$> (remainder of $days divided by 3 = 2)
<$mt:Var name="days" op="++"$> ($days plus 1 = 12)

Output

 (set the var)
10 (output = 10)
5 (output = 5)
 (output of 30 used to set the valuable of a new variable)
30 (output = 30)
 (output of 11 used to update the value of the "days" variable)
2 (output = 2)
12 (output = 12)

See the <mt:If> tag for supported values for the op attribute and operations examples on the wiki.

prepend

Used to add a value to the beginning of an existing variable. Opposite of append.

Values 1 and 0 (default).

<$mt:Var name="foo" value="bar"$>
<$mt:Var name="foo" value="baz" prepend="1"$>
<$mt:Var name="foo"$>

Output:

bazbar

value

Causes the variable to be assigned the value specified. In this way, this tag is useful for setting variables instead of using <$mt:SetVar$>, <mt:SetVars>, or <mt:SetVarBlock>.

The following are equivalent, they all set the the value of the variable “foo” to “bar”:

<$mt:Var name="foo" value="bar"$>
<$mt:SetVar name="foo" value="bar"$>
<mt:SetVarBlock name="foo">bar</mt:SetVarBlock>

The value can contain anything other than a double quote. If the value is long or contains a double quote, use <mt:SetVarBlock> instead.

If provided with the op attribute, value provides the operand for the specified mathematical operation.

Six Apart has four offices, added four different ways as values of the “offices” array. Then output using the <mt:Loop> tag:

<$mt:SetVar name="offices[0]" value="San Francisco"$>
<$mt:SetVar name="unshift(offices)" value="Tokyo"$>
<mt:SetVarBlock name="offices[2]">Paris</mt:SetVarBlock>
<$mt:SetVar name="offices" index="3" value="New York"$>
<mt:Loop name="offices" glue=", "><$mt:Var name="__value__"$></mt:Loop>

var

Alias of name.

Examples

Variables with Operator

This example outputs the count of entries in the loop which have the tag specified; in this case the tag is set to “Foo”. The variable “tag_count” is initialized and then in the loop, if the entry is tagged with the value of “tag_label”, then the “tag_count” variable is incremented. Finally the “tag_count” variable is output if it is a non-zero or non-empty value.

<$mt:Var name="tag_label" value="Foo"$>
<$mt:Var name="tag_count" value="0"$>
<ul>
<mt:Entries>
    <li>
        <$mt:EntryTitle$>
    <mt:EntryIfTagged tag="$tag_label">
        is tagged "<$mt:Var name="tag_label"$>"
        <$mt:Var name="tag_count" op="++" setvar="tag_count"$>
    </mt:EntryIfTagged>
    <mt:If tag="EntryTags">
        (tags: <mt:EntryTags glue=", "><$mt:TagLabel$></mt:EntryTags>)
    </mt:If>
    </li>
</mt:Entries>
</ul>
<mt:If name="tag_count">
    <p>On this page there are <$mt:Var name="tag_count"$> entries tagged "<$mt:Var name="tag_label"$>".</p>
</mt:If>

Array Variables

Add items to an array “sandwich”:

<$mt:Var name="sandwich" index="0" value="bagel"$>
<$mt:Var name="sandwich" index="1" value="cream cheese"$>
<$mt:Var name="sandwich" index="2" value="lox"$>

An alternate syntax, just for reference:

<$mt:Var name="sandwich[1]" value="bagel"$>
<$mt:Var name="sandwich[2]" value="cream cheese"$>
<$mt:Var name="sandwich[3]" value="lox"$>

Let’s take an item off the end of the array and then add a new to the end of the array:

<$mt:Var name="sandwich" function="pop" setvar="removed_ingredient"$>
<$mt:Var name="sandwich" function="push" value="tomato"$>

Output them glued with comma and space. Then is concatenated with a period using the cat modifier.

The sandwich has <$mt:Var name="count(sandwich)"$> ingredients: <$mt:Var glue=", " cat="." name="sandwich"$> The removed item is: <$mt:Var name="removed_ingredient"$>.

Final output:

The sandwich has 3 ingredients: bagel, cream cheese, tomato. The removed item is: lox.

The ingredients can also be output using the <mt:Loop> tag with template loop meta variables:

<mt:Loop name="sandwich">
    <li><$mt:Var name="__value__"$></li>
</mt:Loop>

Hash Variables

Loop through the last 20 entries and list each author once (skip if already found), limit to 4. This code assumes that there will be at least 4 unique bloggers in the last 20 entries. If not increase the lastn value.

<$mt:Var name="author_limit" value="4"$>
<$mt:Var name="author_count" value="0"$>
<mt:Entries lastn="20">
    <mt:EntriesHeader>
<h2>Recent Bloggers</h2>
<ul>
    </mt:EntriesHeader>
    <mt:If name="author_count" lt="$author_limit">
        <$mt:EntryAuthorID setvar="current_author_id"$>
        <mt:Unless name="recent_bloggers{$current_author_id}">
            <li>
                <$mt:EntryAuthorDisplayName encode_html="1"$><br />
                <a href="<$mt:EntryPermalink$>"><$mt:EntryTitle$></a>
            </li>
            <$mt:SetVar name="author_count" op="++"$>
            <$mt:SetVar name="recent_bloggers{$current_author_id}" value="1"$>
        </mt:Unless>
    </mt:If>
    <mt:EntriesFooter>
</ul>
    </mt:EntriesFooter>
</mt:Entries>

Loop though the blogs in the install and ouput an additional message for blog with the id of 1:

<mt:SetVarBlock name="BlogExtras{1}">
    This the blog with the ID of 1
</mt:SetVarBlock>
<mt:Blogs>
    <$mt:BlogID setvar="BlogID"$>
    <div>
        <a href="<$mt:BlogURL$>"><$mt:BlogName$></a>
        <mt:If name="BlogExtras{$BlogID}">
            <$mt:Var name="BlogExtras{$BlogID}"$>
        </mt:If>
    </div>
</mt:Blogs>

Related

Version

The version number of the Movable Type system.

Example:

    <mt:Version />

W

WidgetManager

An alias for the WidgetSet tag, and considered deprecated.

WidgetSet

Publishes the widget set identified by the name attribute.

Attributes:

  • name (required)

    The name of the widget set to publish.

  • blog_id (optional)

    The target blog to use as a context for loading the widget set. This only affects the loading of the widget set: it does not set the blog context for the widgets that are published. By default, the blog in context is used. You may specify a value of "0" for blog_id to target a global widget set.

Example:

    <$mt:WidgetSet name="Sidebar"$>

X

XMLRPCScript

Returns the value of the XMLRPCScript configuration setting. The default for this setting if unassigned is "mt-xmlrpc.cgi".