Movable Type Enterprise Documentation

Back to docs index

Chapter Utility

In this section:


The current date and time at publishing. Date format tags may be applied with the format attribute along with the language attribute. See Appendix C.

A conditional tag that can be used to represent the opposite of any other conditional tag. This tag must be placed within the conditional tag it is associated with.

For more details see the relevant section of Chapter 8 in the Users and Administrators Guide entitled "Conditional Tags".

You can download the Users and Administrators Guide here.

Displays the current value of a variable set by MTSetVar.

Attributes:

  • name - The name of the variable.

A conditional tag that displays its contents if the tag specified with the tag attribute returns a value (i.e. is not empty or null)

Note that a value of '0' is not considered a null value for this tag and will cause the its contents to be printed. If you want to test numerical return values, you should instead use MTIfNonZero.

Attributes:

  • tag - The tag name to evaluate (with or without the MT prefix)

Other attributes are possible. See third example below.

Examples:

The following will print the entry title as an h2 header if a title was given:

<MTIfNonEmpty tag="EntryTitle">
    <h2><$MTEntryTitle$></h2>
</MTIfNonEmpty>

As with all conditional tags, you can use the MTElse tag inside of MTIfNonEmpty to print something if the value of the tag is empty. Here's a brief example that you might use in an MTEntries block to nicely handle entries without categories:

Category: 
    <MTIfNonEmpty tag="EntryCategory">
        <$MTEntryCategory$>
    <MTElse>
        None
    </MTElse>
    </MTIfNonEmpty>

Finally, if you are testing the value of a tag that has one or more attributes, those attributes can be used with MTIfNonEmpty as well. So, for example, to test

<$MTEntryTitle remove_html="1"$>

you do the following:

<MTIfNonEmpty tag="EntryTitle" remove_html="1">
    <title><$MTEntryTitle remove_html="1"$></title>
</MTIfNonEmpty>

Related topics:

For more details see the relevant section of Chapter 8 in the Users and Administrators Guide entitled "Conditional Tags".

You can download the Users and Administrators Guide here.

A conditional tag that displays its contents if the tag specified with the tag attribute has a value that is not numerically equal to zero. If you want to test for an empty string instead, please use MTIfNonEmpty.

Attributes:

  • tag - The tag name to evaluate (with or without the MT prefix)

Other attributes are possible. See third example below.

Examples:

The following prints "This blog has comments!" if MTBlogCommentCount is not 0:

<MTIfNonZero tag="BlogCommentCount">
    This blog has comments!
</MTIfNonZero>

As with all conditional tags, you can use the MTElse tag inside of MTIfNonZero to print something if the value of the tag is zero. Here's a brief example that you might use in the entry footer of your main index:

<MTIfNonZero tag="EntryCommentCount">
    <a href="<$MTEntryPermalink$>#comments">
        Comments (<$MTEntryCommentCount>)
    </a>
<MTElse>
    <MTIfCommentsAccepted>
        <a href="<$MTEntryPermalink$>#comments">
            Leave a comment
        </a>
    </MTIfCommentsAccepted>
</MTElse>
</MTIfNonZero>

Finally, if you are testing the value of a tag that has one or more attributes, those attributes can be used with MTIfNonZero as well. So, for example, to test

<$MTEntryFlag flag="convert_breaks"$>

you do the following:

<MTIfNonZero tag="EntryFlag" flag="convert_breaks">
    Text formatting is being applied to the entry <$MTEntryTitle$>.
</MTIfNonZero>

Related topics:

For more details see the relevant section of Chapter 8 in the Users and Administrators Guide entitled "Conditional Tags".

You can download the Users and Administrators Guide here.

Used to wrap around blocks of MT template code to prevent them from being processed.

Example code:

<MTIgnore>
    This is a comment block - it will not be output or processed by Movable Type.
    <MTEntries lastn="10000">....</MTEntries>
</MTIgnore>

Includes a template module or external file at this point. One and only one of the following attributes must be specified:

Attributes:

  • module - The name of a template module in the current weblog.
  • 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.

The contents of the file or module are further evaluated for more Movable Type template tags.

Sets the value of a variable.

Attributes:

  • name - The name of the variable.
  • value - The value to be assigned to the variable.

Container tag version of MTSetVar, which can wrap other HTML and MT tags.

Six Apart
Makers of weblog software and services for individuals, organizations and businesses.
This website is powered by Movable Type.