Movable Type templates are composed of special tags embedded within standard chunks of plain text (or HTML, as the case may be). Certain tags are ``container'' tags: they contain what might be called a subtemplate, a chunk of text and MT tags between two other MT tags. Typically a container tag represents either a loop or a conditional.
Non-container tags are simple variable tags: they are placeholders for dynamic pieces of information.
All Movable Type tags are enclosed within less-than greater-than signs,
just like HTML tags. You can optionally insert a $
inside these signs,
like this:
<$MTEntryBody$>
This can be useful to quickly determine whether a particular tag is an HTML tag or a Movable Type tag.
Movable Type tags take attributes to modify their behavior. Tag attributes
work similarly to HTML tag attributes: they are lists of name="value"
pairs,
separated by spaces. For example:
<MTEntries author="Foo" category="Bar">
(Look at the MTEntries
documentation to determine what this does.)
Attribute values must be enclosed in quotes; otherwise they will not be
parsed correctly. When using attributes in a tag where you are using the
$
character after the start and before the end tags, you should place the
attributes before the end $
character. For example:
<$MTEntryDate format="%B %e, %Y"$>
Some tag attributes are global; they apply to all Movable Type variable substitution tags. Global attributes are discussed below in Global Tag Attributes. Other attributes are tag-specific; they apply only to certain tags. These attributes are listed along with the tags that they apply to, below.
Some Movable Type tags are context-sensitive. For example, it only makes
sense to use an MTComments
tag in the context of a particular entry:
for example, in a Comments Popup
template, or in an archive template
designed for use with Individual
entry archives.
<$MTBlog*$>
tags inside of these container tags.
Archive URL
of your weblog, as specified in the Weblog Configuration
screen.
Site URL
(in the Weblog Configuration screen) were
http://www.your-site.com/blog/, the hostname piece would be
www.your-site.com
.
By default, if your weblog URL specifies a port number, the port number
will be included in the value of this tag. You can remove it by setting
the exclude_port
attribute of this tag to 1
.
+|-hh:mm
format. For example, a timezone that is 4
hours ahead of
UTC would be displayed as +04:00
.
This tag is context-sensitive: if you use it in an entry context, the RDF will contain additional information relevant to the entry in question. Otherwise, it will contain generic weblog information.
N
days of entries, where
N
is the number of days you have set in your configuration for this
particular weblog. To alter this behavior, you can provide one of the
following attributes:
N
posts to this weblog, where N
is some number greater
than 0.
lastn
(above), starts M
entries from the most recent,
then displays the N
most recent posts. For example, if you use the following
tag:
<MTEntries lastn="5" offset="5"> ... </MTEntries>
this will display entries 6-10 (inclusive).
NOTE: this only works when used with lastn
.
category name
. Note that this can be a
long list of entries, and you may want to use lastn
to only display a
certain number of entries.
If you wish to pull entries from several categories, or to restrict entries to
those that are assigned to several categories, category name
can include
boolean AND
and OR
logic. Note that it can only include one or the other,
however, so you cannot say Foo AND Bar OR Baz
--that will not work. You can
only say Foo AND Bar AND ...
or Foo OR Bar OR ...
.
For example, if you wished to list all entries assigned to both Foo
and
Bar
you could use:
<MTEntries category="Foo AND Bar"> ... </MTEntries>
author name
. Note that this can be a long
list of entries, and you may want to use lastn
to only display a certain
number of entries.
N
days old.
N
most recently commented-on entries. Each entry will appear in
the list only once, so if, for example, a comment is posted to Entry A, then
a comment to Entry B, then another to Entry A, there will be two entries
displayed: Entry A, then Entry B.
<MTEntries>
tag; this
can be used to override the globally set Sort Order for Entries, set in your
weblog configuration. Valid values are ascend
and descend
.
In this context, ascend
and descend
do not mean only chronological order;
this attribute can be used along with sort_by
(below) to sort, for example,
by entry title, either A to Z (ascend
), or Z to A (descend
).
The default value is descend
.
field name
are title
, status
, modified_on
, author_id
, or
excerpt
.
The most obvious use of this attribute might be to alphabetize your entries, rather than displaying them chronologically. For example, suppose that you are using Movable Type to display a dictionary site. You might wish to group your entries by letter, so you could create 26 categories, A through Z. To build a list of all of the entries in your dictionary, grouped by letter, and sorted alphabetically (assuming that you have entered the word or phrase as the title of each entry), you could do this:
<MTCategories> <$MTCategoryLabel$><br /> <MTEntries sort_by="title" sort_order="descend"> <a href="<$MTEntryPermalink$>"><$MTEntryTitle$></a><br /> </MTEntries><br /> </MTCategories>
NOTE: you can combine lastn
, category
, and author
to filter the
list of entries (days
, however, should be used by itself; if it is used
with any other attribute, the other attribute will override it). For example,
you can supply both lastn
and category
to MTEntries
; doing this does
just what you would expect: it displays the last N entries in a particular
category. If you wished to filter that further, by author name, you could
supply all three of lastn
, category
, and author
:
<MTEntries category="Fun" author="Me" lastn="10"> ... </MTEntries>
This would display the last 10 entries by author Me
in the category Fun
.
draft
or publish
). This isn't
particularly useful in most situations, since on your weblog, only entries with
a status of publish
will be displayed. It is used when exporting your
data through the Export Mechanism.
...
)
will be used, instead.
If you have provided an excerpt for the entry, note that line and paragraph
breaks will not be converted unless you use the convert_breaks
attribute to
this tag:
Excerpt with line breaks converted: <$MTEntryExcerpt convert_breaks="1"$>
If you have turned on automatic line and paragraph break conversion by
checking Convert line breaks
for this entry, paragraphs--blocks of text
separated by two line breaks--will be enclosed within <p> and
</p> tags, and for each single line break remaining, a <br />
tag will be inserted.
Note that you can override the entry-specific Text Formatting
setting
by providing this tag with the convert_breaks
attribute; if this attribute
is present, it always overrides the entry setting. So, for example, if you
have the entry setting turned on, but wish to turn it off for a specific
instance of this tag, you can do so like this:
<$MTEntryBody convert_breaks="0"$>
Note also that if you want to display only the first N words in the entry body, you can use the words attribute. For example, the following will show the first 5 words of the entry body.
<$MTEntryBody words="5"$>
To find the first N words, HTML is first removed from the entry body, then the body split on whitespace.
If you have turned on automatic line and paragraph break conversion by
checking Convert line breaks
for this entry, paragraphs--blocks of text
separated by two line breaks--will be enclosed within <p> and
</p> tags, and for each single line break remaining, a <br />
tag will be inserted.
Note that you can override the entry-specific Text Formatting
setting
by providing this tag with the convert_breaks
attribute; if this attribute
is present, it always overrides the entry setting. So, for example, if you
have the entry setting turned on, but wish to turn it off for a specific
instance of this tag, you can do so like this:
<$MTEntryMore convert_breaks="0"$>
Preferred Archive Type
. This is the default behavior; to
override it you can provide this tag with the attribute archive_type
,
setting it to the archive type you wish to link to.
For example, say that you have selected Individual
archiving as your
Preferred Archive Type
. The following tag:
<$MTEntryLink$>
would produce a link to the individual entry archive page for this entry. That
file name would be the ID of the entry, zero-padded to 6 digits, followed by
your weblog's Archive File Extension
(eg. html
).
If you had also enabled By Category
archiving for this weblog, though, you
might wish to link instead to the category archive for a particular entry. To
do this, you could use this tag:
<$MTEntryLink archive_type="Category"$>
This tag would be substituted by a link to the category archive page for this entry.
If you want true permalinks--that is, links that will always link to a
particular entry, even when it is archived on a page with several other
entries--you should use the <$MTEntryPermalink$>
tag.
#
) pointing to the actual entry (by ID). This is the same as
<$MTEntryLink$>
, but smarter, in that it includes the anchor in
all cases except individual archives, where the anchor is redundant.
Like <$MTEntryLink$>
, this tag takes an optional attribute
archive_type
to specify the archive type to link to.
If the spam_protect
attribute is provided, the email address will be
modified so as to prevent spambots from harvesting it. The web browser,
however, will still display the email address properly. For example, if the
email address is foo@bar.com
, and you use
<$MTEntryAuthorEmail spam_protect="1"$>
the email address will be displayed as foo@bar.com
.
You can override these rules by using the show_email and show_url attributes to the tag. For example, if you use
<$MTEntryAuthorLink show_email="0"$>
then the email address of the author will never be displayed. The logic then becomes: if the author has entered a URL, the author name will be a link to that URL; if no URL, display the author name without a link.
If the spam_protect
attribute is provided, and the email link is to be
displayed, the email address will be modified so as to prevent spambots from
harvesting it. The web browser, however, will still display the email address
properly. For example, if the email address is foo@bar.com
, and you use
<$MTEntryAuthorLink spam_protect="1"$>
the email address will be displayed as foo@bar.com
.
format
and language
attributes. See Date Tag Formats for more
information.
format
and language
attributes. See Date Tag Formats for
more information.
<MTEntryIfExtended> <a href="<$MTEntryLink$>#<$MTEntryID$>">More...</a> </MTEntryIfExtended>
Allow comments
setting is set to either Open
or Closed
in the Edit entry
screen
for this entry).
You can use this to display a link to comments on this entry, but only
(of course) if comments are allowed.
See the Comments section in ENTRIES (above) for examples of using this tag.
Open
for this entry. You can use this to
conditionally display the ``Post a comment'' form, for example.
Allow Pings
setting is turned on in the Edit an entry
screen for this entry).
See the TrackBack documentation for examples of using this tag.
8
, this tag will produce
only the value 8
. Sometimes you would rather have your IDs padded; in
that case, you can use the pad attribute to the MTEntryID
tag:
<$MTEntryID pad="1"$>
This will zero-pad the entry ID to six (6) digits, like 000008
.
<$MTCategory*$>
tags
(documentation) to display information about each
category.
You can supply this tag with the glue attribute to separate each of the categories with a string; this is useful when you wish to separate the category names with a comma, for example. Note that your the value of the glue attribute cannot contain either a single or double quote.
For example:
This entry was posted in the following categories: <MTEntryCategories glue=", "> <a href="<$MTCategoryArchiveLink$>"><$MTCategoryLabel$></a> </MTEntryCategories>
convert_breaks
and allow_comments
. If the flag value
is true, the value 1
is displayed; otherwise, the value 0
is
displayed. The flag name is passed along in the flag
attribute. For
example:
<$MTEntryFlag flag="allow_comments"$>
This tag is used for exporting entry data through the Export mechanism; you probably will not need to use it yourself, in your templates.
MTEntryPrevious
context, for
example, an <$MTEntryTitle$> tag refers to the title of the previous
entry. After you end this context (with a </MTEntryPrevious> tag),
tags return to referring to the current entry.
See the documentation for MTEntryNext
(below) for an example of usage of
this tag.
MTEntryNext
context, for
example, an <$MTEntryTitle$> tag refers to the title of the next
entry. After you end this context (with a </MTEntryNext> tag), tags
return to referring to the current entry.
Here is an example of navigation that links to the previous and next entries, along with a link back to the main index for your weblog.
<MTEntryPrevious> <a href="<$MTEntryLink$>"><< <$MTEntryTitle$></a> | </MTEntryPrevious> <a href="<$MTBlogURL$>">Main</a> <MTEntryNext> | <a href="<$MTEntryLink$>"><$MTEntryTitle$> >></a> </MTEntryNext>
MTEntries
container. For example:
<MTEntries> <MTDateHeader> <$MTEntryDate format="%B %e, %Y"$> </MTDateHeader> Title: <$MTEntryTitle$> </MTEntries>
MTDateHeader
tag to wrap all of
your posts from a particular day in some sort of structure (a div
, for
example). Like MTDateHeader
, this tag is only useful inside an MTEntries
container. For example:
<MTEntries> <MTDateHeader> <div class="day"> <$MTEntryDate format="%B %e, %Y"$> </MTDateHeader> Title: <$MTEntryTitle$> <MTDateFooter> </div> </MTDateFooter> </MTEntries>
<MTEntries>
container.
<MTEntries>
container.
This could be used, for example, to link to the preview entry's archive page
from your index page. If you are using Daily archives, for example:
<MTEntries days="1"> ... <MTEntriesFooter> <MTEntryPrevious> <a href="<$MTEntryLink archive_type="Daily"$>">Previously: <$MTEntryDate format="%A, %B %d, %Y"$></a> </MTEntryPrevious> </MTEntriesFooter> </MTEntries>
lastn
attribute,
below).
If you provide this tag with the lastn="N"
attribute, where N
is the
number of comments you would like displayed, it will list either the N
most recent comments on the particular entry--if used in entry context--or
the N
most recent comments in your weblog, if used elsewhere.
If you do not provide this tag with any attributes, <MTComments>
will list all of the comments on the particular entry in context. This means,
of course, that when using this tag without attributes, it must be used in an
entry context: within <MTEntries>
, in an Individual entry archive
template
, in a Comment Preview template
, in a Comment Listing template
,
or in a Comment Error template
.
By default, the comments will be sorted in the order you have specified for
the Order of comments displayed in your weblog configuration. You can
override this setting by providing this tag with the sort_order
attribute,
the value of which should be either ascend or descend.
For example, to display the 6 most recent comments made on any of the entries in your weblog, and sort them in reverse chronological order (most recent first), you can put the following into your Main Index Template:
<MTComments lastn="6" sort_order="descend"> <p><$MTCommentAuthor$> said:<br /> <$MTCommentBody$></p> </MTComments>
For each comment in the list of comments, the text and tags inside the container will be displayed. Each of the tags below are used to display a particular variable piece of a comment.
8
, this tag will
produce only the value 8
. Sometimes you would rather have your IDs padded;
in that case, you can use the pad attribute to the tag:
<$MTCommentID pad="1"$>
This will zero-pad the comment ID to six (6) digits, like 000008
.
<MTComments lastn="N">
, because it allows you to link to
the particular entry on which the comment has been made.
This tag takes an optional pad
attribute that works just like the pad
attribute in <$MTCommentID$>
, above.
You can override these rules by using the show_email and show_url attributes to the tag. For example, if you use
<$MTCommentAuthorLink show_email="0"$>
then the email address of the author will never be displayed. The logic then becomes: if the author has entered a URL, the author name will be a link to that URL; if no URL, display the author name without a link.
This is useful when you want to force your visitors to leave their email addresses--that is, you have not checked the Allow anonymous comments checkbox in your weblog configuration--but you do not want to display these email addresses on your weblog.
If the spam_protect
attribute is provided, and the email link is to be
displayed, the email address will be modified so as to prevent spambots from
harvesting it. The web browser, however, will still display the email address
properly. For example, if the email address is foo@bar.com
, and you use
<$MTCommentAuthorLink spam_protect="1"$>
the email address will be displayed as foo@bar.com
.
By default MTCommentAuthorLink will use a redirection to obscure the
commenter's URL from search engines. This may reduce the incentive of
comment-spammers to leave unsolicited comments in order to increase
their rank on some search engines. If you prefer not to use this
redirection, you may use the attribute no_redirect
:
<$MTCommentAuthorLink no_redirect="1"$>
If the spam_protect
attribute is provided, the email address will be
modified so as to prevent spambots from harvesting it. The web browser,
however, will still display the email address properly. For example, if the
email address is foo@bar.com
, and you use
<$MTCommentEmail spam_protect="1"$>
the email address will be displayed as foo@bar.com
.
Convert line and paragraph
breaks
in your weblog configuration, paragraphs--blocks of text separated by
two line breaks--will be enclosed within <p> and </p> tags,
and for each single line breaks, a <br /> tag will be inserted.
Note that you can override the global Convert line and paragraph breaks
setting by providing this tag with the convert_breaks
attribute; if this
attribute is present, it always overrides the global setting. So, for example,
if you have the global setting turned on, but wish to turn it off for a
specific instance of this tag, you can do so like this:
<$MTCommentBody convert_breaks="0"$>
format
and language
attributes. See
Date Tag Formats for more information.
1
. Note that the order is dependent on the sort order
(ascending or descending).
<$MTEntry*$>
tags to refer to that entry. For
example, you could do
<MTComments lastn="5" sort_order="descend"> <MTCommentEntry> This comment was made on the entry <$MTEntryTitle$>. </MTCommentEntry> </MTComments>
When creating the Comment Preview Template
for use in previewing comments
before they are posted to your site, you should use the following tags. All
of these tags have the same meaning as the similarly-named tags in Comments
,
above; the only different is that these tags are used for the comment that
you are previewing, whereas the others are used inside of an
<MTComments>
block.
Comments
, above.
Comment Preview
and Comment
Error
templates so that the system will know where to redirect your users
after posting a comment. To use this tag, paste this hidden input field into
the forms on your Comment Preview
and Comment Error
templates:
<input type="hidden" name="static" value="<$MTCommentPreviewIsStatic$>">
<$MTCommentPreviewState$>
tag.
A magic tag that you need to use on a comment preview page (the Comment
Preview Template
). This tag is substituted with all of the necessary comment
data in order to post the comment, as well as knowledge of whether the comment
is being posted from inline or popup comments.
The following template tags and variables apply to your archive pages and to your Master Archive Index.
MTEntries
tag to display information about each of the entries
on this archive page. For example:
<MTArchiveList> <a href="<$MTArchiveLink$>"><$MTArchiveDate$></a><br> <MTEntries> [<$MTEntryTitle$>] </MTEntries> <br><br> </MTArchiveList>
This will display a link to the archive page, followed by a list of titles of each of the entries on that page.
This tag takes two attribute: archive_type
, which specifies the type of
archives to list; and lastn
, which limits the number of archives listed.
The attribute archive_type
is optional; if omitted, the listing will
use your Preferred Archive Type, or your Archive Type. The attribute is
useful when you have selected more than one value for the weblog's Archive
Type, and you wish to list the archives for an archive type other than your
Preferred Archive Type. For example, if you have chosen to keep both
Individual
and Daily
archives, and your Preferred Archive Type is
Individual
, you can list your Daily
archives using this tag:
<MTArchiveList archive_type="Daily"> ... </MTArchiveList>
lastn
can be used to limit the number of archives in the list; for example,
if you have 10 months worth of archives in your weblog, and you only wish to
list the last 5, you can use this:
<MTArchiveList archive_type="Monthly" lastn="5"> ... </MTArchiveList>
By default, the link is to the archive page of the archive type currently
being built; for example, when building a list of Monthly
archives,
<$MTArchiveLink>
will generate a link to a particular Monthly
archive. To override this behavior, you can specify the attribute
archive_type
, which should be set to one of the following values:
Individual
, Daily
, Weekly
, Monthly
, or Category
.
Month Day, YYYY
form.
Month Day, YYYY - Month Day, YYYY
form.
Month YYYY
form.
Using MTArchiveTitle
in combination with MTArchiveLink
is the easiest
way to create your master archive index pages, because the MTArchiveTitle
value will adapt to whatever type of archiving you choose. For example:
<MTArchiveList> <a href="<$MTArchiveLink$>"><$MTArchiveTitle$></a><br> </MTArchiveList>
No matter what archive type you choose, this will always display a useful list of your archive pages.
<MTArchiveList>
container, like this:
<MTArchiveList> <a href="<$MTArchiveLink$>"><$MTArchiveTitle$> (<$MTArchiveCount$>)</a><br> </MTArchiveList>
Daily
, Weekly
, or Monthly
archives. This is a standard date
tag; see below in Date Tag Formats for information on formatting the
date.
You can use this tag inside of an MTArchiveList
container, and you can
also use it in an archive template associated with a date-based archive type,
outside of the MTEntries
tag. You can use this to display a header about
the dates represented on a particular archive page--the month and year, for
example:
<$MTBlogName$> Archives: <$MTArchiveDate format="%B %Y"$> <MTEntries> ... </MTEntries>
Daily
, Weekly
, or Monthly
archive context, and will fail in any
other situation. This is a standard date tag; see below in Date Tag Formats
for information on formatting the date.
You can use this tag in the same scenarios as the <$MTArchiveDate>
tag.
Category
archives.
You can use this tag inside of an MTArchiveList
container, and you can
also use it in an archive template associated with your Category
archives,
outside of the MTEntries
tag. You can use this to display a header about
the category of entries represented on a particular archive page. For example:
<$MTBlogName$> Archives: <$MTArchiveCategory$> <MTEntries> ... </MTEntries>
MTArchivePrevious
context, for
example, an <$MTArchiveTitle$> tag refers to the title of the previous
archive. After you end this context (with a </MTArchivePrevious> tag),
tags return to referring to the current archive.
This tag should be used in archive templates that you associate with Daily
,
Weekly
, or Monthly
archives; if you want a similar behavior in your
individual entry archives, take a look at the <MTEntryPrevious>
tag.
By default the ``previous'' archive is based on the type of archive on which the
tag is found--for example, in a Daily
archive, the ``previous'' archive is
the previous day with an entry. If you would like to override this
behavior--for example, if you'd rather link to the previous month's
archives--you can use the archive_type
attribute (see below for an
example).
See the documentation for <MTArchiveNext>
(below) for an example of
usage of this tag.
MTArchiveNext
context, for
example, an <$MTArchiveTitle$> tag refers to the title of the next
archive. After you end this context (with a </MTArchiveNext> tag), tags
return to referring to the current archive.
This tag should be used in archive templates that you associate with Daily
,
Weekly
, or Monthly
archives; if you want a similar behavior in your
individual entry archives, take a look at the <MTEntryNext>
tag.
By default the ``next'' archive is based on the type of archive on which the
tag is found--for example, in a Daily
archive, the ``next'' archive is
the next day with an entry. If you would like to override this behavior--for
example, if you'd rather link to the previous month's archives--you can use
the archive_type
attribute.
Here is an example of navigation that links to the previous and next archives, along with a link back to the main index for your weblog.
<MTArchivePrevious> <a href="<$MTArchiveLink$>"><< <$MTArchiveTitle$></a> | </MTArchivePrevious> <a href="<$MTBlogURL$>">Main</a> <MTArchiveNext> | <a href="<$MTArchiveLink$>"><$MTArchiveTitle$> >></a> </MTArchiveNext>
Here is an example of navigation that could be used on a Daily
archive to
link to the previous and next month's archives. This might be useful if you
use a calendar on all of your Daily
archives, and want to link to the next
and previous month's calendar.
<MTArchivePrevious archive_type="Monthly"> <a href="<$MTArchiveLink archive_type="Monthly"$>"><$MTArchiveDate format="%b"$></a> </MTArchivePrevious> <MTArchiveNext archive_type="Monthly"> <a href="<$MTArchiveLink archive_type="Monthly"$>"><$MTArchiveDate format="%b"$></a> </MTArchiveNext>
The following tags can be used to display a list of the categories in your weblog, and information about each category (ID, label, etc.).
<MTEntries>
tag to display information about each of the entries
in this category. For example:
<MTCategories> <a href="<$MTCategoryArchiveLink$>"><$MTCategoryLabel$></a><br> <MTEntries> <$MTEntryTitle$> </MTEntries> <br /><br /> </MTCategories>
This will display a link to each of your categories, each followed by a list of titles of the entries in that category.
When a category does not contain any entries, by default that category will not
be included in the list of categories; this is the default behavior because it
mirrors the behavior of <MTArchiveList>
. Note that this is advised
if you are including links to your category archive pages, because archive
pages are not generated for empty categories. Thus, the archive link for an
empty category will be a broken link.
If you would like to override this default behavior, you can provide this tag
with the show_empty
attribute. For example, these tags:
<MTCategories show_empty="1"> <$MTCategoryLabel$> </MTCategories>
will display a list of all of your categories, even those that are empty.
Category
archiving for your weblog; if you have not, you will get an
error message when rebuilding your pages.
<MTCategories>
), or
you can specify the category whose TrackBack link you want using the
category attribute. For example:
<$MTCategoryTrackbackLink category="Foo Bar"$>
If you specify the attribute, the tag can be used wherever you want to use it.
The following tags can be used to output a calendar display of your entries. The calendar display is not restricted to construction using HTML tables; the tags are sufficiently generic that you could use them to create a calendar in many different forms.
<MTCalendar>
and </MTCalendar>
tags represents a single
``cell'' in the calendar (which is either a day of the month or a blank cell
representing a day in a different month).
This tag takes an optional attribute month
, which, if present, specifies the
desired calendar month and year. If the value of this attribute is the string
this
, the calendar will be created in the surrounding date context; this
means that, for example, in an archive template, you can use
<MTCalendar month="this"> ... </MTCalendar>
to represent the calendar for the month of the archive currently being viewed.
This will work for Individual
, Daily
, Weekly
, and Monthly
archives,
not for Category
archives.
If the value of the month
attribute is last
, the calendar will be
created for the previous month, relative to the current date.
If you'd like to create a calendar for a specific month, you can use the
month
attribute to specify the exact month and year, in YYYYMM
format
(example: 200112
).
If the month
attribute is not provided, the calendar will display the
current month.
If you would like to only display entries from a certain category, you can
specify the category
attribute, giving it the name of the category. For
example, this tag:
<MTCalendar month="200201" category="Foo"> ... </MTCalendar>
will display all entries from January, 2002 in the category Foo
.
1
). You can use this tag within the
<MTCalendarIfEntries>
and <MTCalendarIfNoEntries>
containers.
1
for the
first cell in the top left corner of the calendar and increases as you move
across the calendar horizontally.
This tag is different than <$MTCalendarDay$>
(above) in that the
latter tag applies only in a non-``blank'' cell (ie. an entry that represents a
day in this particular month).
format
attribute. If you only wish to display the numeric day, just use
<$MTCalendarDay$>
; you need only use this tag when you want more
date/time information in the display.
<MTCalendarWeekHeader>
and </MTCalendarWeekHeader>
will be displayed at the start of each
week.
<MTCalendarWeekFooter>
and </MTCalendarWeekFooter>
will be displayed at the end of each
week.
<MTCalendarIfBlank>
and </MTCalendarIfBlank>
will be displayed if the cell is a ``blank''
cell--that is, if it does not represent a day in this month.
<MTCalendarIfEntries>
and </MTCalendarIfEntries>
will be displayed if there are any
entries from the day represented by this cell. You can use the
<MTEntries>
tag to list all of the entries on that particular day.
For example:
<MTCalendarIfEntries> Entries from this day: <MTEntries> <a href="<$MTEntryLink$>"><$MTEntryTitle$></a><br /> </MTEntries> </MTCalendarIfEntries>
<MTCalendarIfNoEntries>
and </MTCalendarIfNoEntries>
will be displayed if there are no
entries from the day represented by this cell.
<MTCalendarIfToday>
and </MTCalendarIfToday>
will be displayed if the day represented
by the calendar cell is the current date.
Here is the markup for a fairly standard calendar display; this will display a calendar for the current month.
<table border="0" cellspacing="4" cellpadding="0" summary="Monthly calendar"> <caption><$MTDate format="%B %Y"$></caption> <tr> <th abbr="Sunday" align="center">Sun</th> <th abbr="Monday" align="center">Mon</th> <th abbr="Tuesday" align="center">Tue</th> <th abbr="Wednesday" align="center">Wed</th> <th abbr="Thursday" align="center">Thu</th> <th abbr="Friday" align="center">Fri</th> <th abbr="Saturday" align="center">Sat</th> </tr> <MTCalendar> <MTCalendarWeekHeader><tr></MTCalendarWeekHeader> <td <MTCalendarIfToday>bgcolor="#EEEEEE"</MTCalendarIfToday> align="center"> <MTCalendarIfEntries><MTEntries lastn="1"><a href="<$MTEntryLink$>"><$MTCalendarDay$></a></MTEntries></MTCalendarIfEntries> <MTCalendarIfNoEntries><$MTCalendarDay$></MTCalendarIfNoEntries> <MTCalendarIfBlank> </MTCalendarIfBlank></td> <MTCalendarWeekFooter></tr></MTCalendarWeekFooter> </MTCalendar> </table>
NOTE: the computation of the calendar display is relatively expensive, so if you wish to place the same calendar on every page of your site, it is advisable to create the calendar in an index template, then use server side includes or PHP (or any other dynamic webserver tool) to include that file in each of your pages.
These are tags related to the TrackBack system.
If used within the context of an entry--for example, in the TrackBack Listing Template--this tag will list all of the TrackBack pings sent to that particular entry.
If used in a template associated with a category archive, this tag will list all of the TrackBack pings sent to that category.
If used in any other context, this tag will list all of the TrackBack pings sent to your system (unless provided with the lastn tag--see below).
Additionally, you can provide this tag with the name of the category whose pings you wish to list using the category attribute:
<MTPings category="Foo"> ... </MTPings>
You can also provide this tag with sort_order and lastn attributes,
which work the same way that they do with other Movable Type tags. The
value of sort_order can be either ascend
or descend
. The value of
lastn should be a positive integer to list the N most recent TrackBack
pings.
For example, to display the last 15 pings in the category Foo Bar
on the
front page of your weblog, add the following to your Main Index Template:
<MTPings category="Foo Bar" lastn="15"> <a href="<$MTPingURL$>"><$MTPingTitle$></a><br /> </MTPings>
format
and language
attributes. See
Date Tag Formats for more information.
For example:
<MTPingsSent> URL: <$MTPingsSentURL$><br /> </MTPingsSent>
<MTPingsSent>
tag.
The following tags can only be used in your search templates.
<$MTEntry*$>
tags, because the entry represented by the search
result will be in context. You can also use any <$MTBlog*$>
tags to access data referring to the weblog in which the particular entry
result was found.
For example:
<MTSearchResults> <MTBlogResultHeader> <h2>Results from <$MTBlogName$></h2> </MTBlogResultHeader> <h3><a href="<$MTEntryLink$>#<$MTEntryID pad="1"$>"><$MTEntryTitle$></a></h3> <$MTEntryExcerpt$> <$MTEntryEditLink$><br /> <div class="posted">Posted in <$MTBlogName$> on <$MTEntryDate$></div> </div> </MTSearchResults>
For example:
<MTNoSearchResults> <h2>Searched for "<$MTSearchString$>"</h2> <p>No pages were found containing "<$MTSearchString$>".</p> </MTNoSearchResults>
http://YOURDOMAIN.COM/PATH-TO/mt-search.cgi
Or, in the case of the new comment search, if the visitor went to
http://YOURDOMAIN.COM/PATH-TO/mt-search.cgi?Type=newcomments&help=1
A good use for this tag might be to display search instructions, or a more advanced search form.
For example:
<MTNoSearch> <h2>Instructions</h2> <p>... Some search instructions ...</p> </MTNoSearch>
This tag is a container tag whose contents are displayed if the search result in context is the first result in the weblog grouping. This is useful for displaying the name of the weblog, and perhaps a link to the main index for the weblog.
These are tags which really don't fit in any of the above categories.
<MTElse>
tag to supply an ``else'' condition for any
conditional tag. That is, generally any tag with If
in its name (for
example, <MTEntryIfExtended>
). <MTElse>
is a container
tag whose contents will be displayed if the condition is not met. The
<MTElse>
container should be placed within the container of
the conditional tag for which it is providing the ``else'' condition.
Here is an example of usage:
<MTEntryIfExtended> This entry has an extended body. <MTElse> This entry does not have an extended body. </MTElse> </MTEntryIfExtended>
MTIfNonEmpty
tag to check whether the value of another tag would
not be empty. The other tag name should be supplied in the tag
attribute
to this tag. This is a conditional tag, so the markup inside of the tag
will be displayed if the condition (a non-empty value for the result of
evaluating tag
) is true.
For example:
<MTIfNonEmpty tag="MTEntryAuthorURL"> The author's homepage URL is <$MTEntryAuthorURL$>. </MTIfNonEmpty>
MTInclude
tag to include either a template module (see Template
Modules, above, in TEMPLATES), or an external file,
into another template. <MTInclude>
takes the following attributes:
Header
, then include it
using <MTInclude>
:
<$MTInclude module="Header"$>
Local Site Path
directory, or your Local Archive Path
directory. For
example, if the file foo.html exists in your local site path directory,
you can include it in a template like this:
<$MTInclude file="foo.html"$>
This file is included in your template when the page is rebuilt; note that
this behavior should not be confused with server side includes, which will
include the external file every time the webserver serves a request for your
page. After making changes to an external file that you are including through
<MTInclude>
, then, note that you will need to rebuild your pages to
include the modified version of the page.
<MTLink>
tag to automatically generate the URL
for an index template or an entry in the system. <MTLink>
takes
the following attributes:
About Page
, you could use:
<a href="<$MTLink template="About Page"$>">My About Page</a>
<a href="<$MTLink entry_id="562"$>">Link to a certain entry</a>
Last updated at
slug, for
example:
This page last updated at <$MTDate format="%B %d, %Y %I:%M %p"$>.
This tag can be given the following attributes:
1
,
in which case the pages will be similar to your page (assuming that you have
set your Site URL to the URL for your main page). See below for an
example.
10
.
For example, to list the top 5 search results for the query movable type
:
<MTGoogleSearch query="movable type" results="5"> <a href="<$MTGoogleSearchResult property="URL"$>"><$MTGoogleSearchResult property="title"$></a><br /> </MTGoogleSearch>
Or, for a list of pages similar to your page:
<MTGoogleSearch related="1"> <a href="<$MTGoogleSearchResult property="URL"$>"><$MTGoogleSearchResult property="title"$></a><br /> </MTGoogleSearch>
Note that query, related, title, and excerpt are all mutually exclusive.
Also note that if you use the Google Search tag in your Individual Archive Template, the list of search results will be generated whenever you save an entry. This can slow down the rebuilding process, and if you post quite a bit, or get a lot of comments on your site, you may exceed the number of queries per day that you are allowed by Google.
NOTE: usage of this tag requires that you have obtained a Google API key and pasted it into your weblog configuration, and that you have installed the SOAP::Lite and LWP::UserAgent modules (run mt-check.cgi to determine if you have these modules installed).
<MTGoogleSearch>
,
above).
Takes one attribute, property, which specifies the field of the search
result to be displayed (for example: title, URL, summary, etc.). The default
property is title
.
Valid values for property include: summary
, URL
, snippet
,
and title
.
name
attribute, and the value using the value
attribute. You can then
retrieve the value of the variable using the tag <MTGetVar>
(below).
name
attribute
to this tag. For example
For example, you can set the value of a variable foo
in an outer template:
<MTSetVar name="foo" value="bar">
and then, in an included template module, grab the value of that variable:
<MTGetVar name="foo">
CGIPath
configuration file line
(set during installation; see the Installation Instructions). MTCGIPath
makes linking to Movable Type CGI scripts--such as mt-comments.cgi and
mt-add-notify.cgi--very simple; instead of having to type in the URL to
these CGI scripts every time you use them in your templates, instead you
should just use this tag. For example, when creating a form for posting
comments:
<form method="post" action="<$MTCGIPath$><$MTCommentScript$>">
Uploaded
Image Popup Template
.
Uploaded Image
Popup Template
.
Uploaded Image
Popup Template
.
Comment Error Template
; it will be
replaced with the text of the error that occurred in the comment submission
process (for example, an invalid or missing email address).
2.0
.
iso-8859-1
.
Global tag attributes can be used in any variable substitution tag (a tag that is replaced with a value--in contrast to a container tag, which ``contains'' a set of markup and other tags). However, this does not mean that they would necessarily make sense when used in any tag; it is up to the user to determine when using a particular tag attribute might not make practical sense.
You should use a global attribute just as you would use a tag-specific
attribute: as a name="value"
pair within the tag. For example:
<$MTEntryExcerpt encode_html="1"$>
This will be replaced with an HTML-encoded version of the excerpt.
Here is a list of the global tag attributes:
,
). If you specify multiple
filters, they will be executed in the order in which you list them. For
example, if you have defined a filter with the short name wiki, which
runs a string through the Text::WikiFormat CPAN module, you could do
this:
<$MTEntryTitle filters="wiki"$>
to turn a title of ''This is a title''
into
<em>This is a title</em>
.
1
, HTML-encodes the tag value. For example, if the value of the
tag without this attribute were Foo & Bar -> Baz
, the HTML-encoded
version would be Foo & Bar -> Baz
.
Example usage:
<$MTEntryExcerpt encode_html="1"$>
1
, encodes into entities any characters that XML requires
to be encoded. These are: &
,
, <
, and >
.
For example, if the value of the tag without this attribute were
Foo & Bar -> Baz
, the XML-encoded version would be
Foo & Bar -> Baz
.
Example usage (in an RSS template);
<item> <title><$MTEntryTitle encode_xml="1"$></title>
Note: The difference between this and encode_html is that the latter encodes a much wider set of special characters into HTML entities, if you have the HTML::Entities module installed and you have not turned on the NoHTMLEntities option in mt.cfg.
1
, encodes the tag value into a format suitable for usage in
a Javascript string value. For example, if the value of the tag without this
attribute were Foo "Bar" Baz's 1/2 Quux
, the encoded version would be
Foo \"Bar\" Baz\'s 1\/2 Quux
.
Example usage:
<script language="javascript"> var str = '<$MTEntryTitle encode_js="1"$>'; </script>
q
(single-quote), qq
(double-quote),
or heredoc
(here document--note that here
will also work for a here
document).
Example q
usage:
<?php $str = '<$MTEntryTitle encode_php="q"$>' ?>
Example heredoc
usage:
<?php $str = <<<HERE <$MTEntryBody encode_php="heredoc"$> HERE; ?>
foo bar
would be transformed into foo%20bar
.
Example usage:
<a href="/search?q=<$MTEntryTitle encode_url="1"$>">Search</a>
(Thanks to Scott Andrew LePera for providing the original example on which this is based.)
1
, decodes all HTML entities in the tag value. For example, if
the value of the tag without this attribute were foo<br>
,
the version with decoded HTML entities would be foo<br>
.
Example usage:
<$MTEntryTitle decode_html="1"$>
1
, decodes all XML entities in the tag value. For example, if
the value of the tag without this attribute were foo<br>
,
the version with decoded HTML entities would be foo<br>
.
Example usage:
<$MTEntryTitle decode_xml="1"$>
1
, strips all HTML tags from the tag value. For example,
if the value of the tag without this attribute were Foo<br> Bar
,
the version without HTML tags would be Foo Bar
.
Example usage:
<$MTEntryTitle remove_html="1"$>
1
, ``dirifies'' the tag value. This means that the value of the
tag is made suitable for usage in a file or directory name: the value is
converted to lower case, HTML tags and entities are stripped, strange
characters are stripped (where strange is defined as not included in the
following set: alphanumeric characters, underscore (_
), and whitespace),
and whitespace is then converted to underscores (_
).
dirify also converts certain high-ASCII characters (accented characters,
etc) to their low-ASCII characters, meaning that something like
crudit
will be converted to crudite
.
For example, if the value of the tag without this attribute were
Foo "Baz" is<br> Bar!
, the dirified version would be
foo_baz_is_bar
.
Example usage:
<$MTArchiveCategory dirify="1"$>
Example usage:
<$MTEntryTitle upper_case="1"$>
Example usage:
<$MTArchiveDate format="%B" lower_case="1"$>
Example usage:
<$MTEntryTitle trim_to="15"$>
The above tag will only display the first 15
characters in the entry title.
Example usage:
<$MTCalendarDay space_pad="3"$>
The above tag will pad the value 3
to `` 3
''.
Example usage:
<$MTCalendarDay zero_pad="5"$>
The above tag will pad the value 8
to 00008
.
<$MTCalendarDay sprintf="%05s"$>
1
, the default sanitize spec--for the weblog, or for the global
settings--is used. If the value is 0
, sanitizing will be turned off for
this tag. If the value is anything else, it will be treated as the sanitize
spec to be used.
Example usage:
<$MTEntryBody sanitize="a href"$>
This would strip all HTML tags except for <a>
(with the href
attribute) from the entry body.
Movable Type uses standard strftime
format strings to describe dates
and times. (However, note that strftime
itself is not actually used to
perform the formatting.) In any date tag, you should use the format
attribute to specify the format string, like this:
<$MTDate format="%B %e, %Y %I:%M %p"$>
The above format is actually the default format for English date formatting, and creates a date looking like this:
September 20, 2001 11:44 PM
The language used in weekday names, month names, and AM/PM specifiers can be
chosen in the Weblog Configuration as Language for date display
. The default
language used is English
.
You can override the default language setting by using the language
attribute to specify the language; this will apply only for the particular
date string that you are formatting. Here is the list of available language
tags: cz
, dk
, nl
, en
, fr
, de
, is
, jp
, it
, no
,
pl
, pt
, si
, es
, fi
, se
.
Here is a list of the format specifiers.
Thu
.
Thursday
.
Sep
.
September
.
0
if necessary. Example:
09
.
9
.
0
if necessary. Example: 16
.
0
if necessary.
Example: 04
.
0
s if necessary. Example:
056
.
9
.
4
.
0
if necessary. Example: 09
.
0
if necessary. Example: 02
.
AM
or PM
.
0
if necessary. Example: 04
.
September 6, 2002
.
4:31 PM
.
0
if necessary. Example: 01
.
2001
.
NOTE: As of version 2.0 of Movable Type, %Z
is no longer supported. If
you want the timezone, take a look at the <$MTBlogTimezone$>
tag.