« Table of Contents
Templates in the Movable Type system are your method of defining the design and layout of your site. Templates describe where you want your content (that is, your entries and archives), what that content should look like, and so on. Generally your templates will be made up of HTML, interspersed with Movable Type template tags and variables (see TEMPLATE TAGS), but this is not a technical limitation; you can use Movable Type to generate plain text, HTML with server-side includes, PHP, and any other text-based language.
You can edit your weblog's templates, and define new templates, by logging in to Movable Type, selecting a weblog, then clicking List & Edit Templates.
There are several different types of templates in Movable Type.
Index templates are your main entry listings. Unlike many other weblog
management systems, Movable Type supports multiple index templates; this means
that you can publish your main entry listings in several formats, for
example, like one listing in HTML, and one in XML. By default, an index
template displays the last
N days worth of entries, where
N is defined
in your weblog configuration. For example, if you set the number of days
displayed on the index to
7, Movable Type will, by default, display all
entries from the last 7 days on all of your index templates. Note that 7 days
means the last 7 consecutive days, not necessarily the last 7 days on
which you posted an entry. So if you have posted on just 3 of the last 7 days,
only the posts from those 3 days will be listed on your main indexes.
As mentioned above, displaying the last
N days of entries is the default
behavior for index templates; this behavior is customizable, however, through
MTEntries tag (see below); for example, you might set your RSS index
(for RSS syndication) to display your last 15 entries, no matter the date.
Archive templates define the look and feel or your weblog archives. For each archive type that you choose (see ARCHIVING), you can associate multiple archive templates with that archive type; this allows for different ``views'' of the same set of archived entries. For example, you might wish to create two different views of your monthly archives: a page containing each of the entries for a particular month, and a calendar view of that month. Or, you could use different templates to create hi-fi and lo-fi versions of your archives.
When an archive type is rebuilt, all of the archive templates associated with the archive type are rebuilt--this allows you to automatically maintain several views of the same archived entries.
Movable Type ships with three archive templates: one for the date-based
Daily), one for your
archives, and one for your
Individual entry archives.
To define a new Archive Template, go to List & Edit Templates, and
Create new archive template. Name the template, then define the
layout for the archive page using Movable Type template tags.
After you have saved the new archive template, go to the Archiving section
of your Weblog Configuration, and click the
ADD NEW... button; in the
popup window, select the template you just created from the Template:
pulldown menu, and select the archive type with which you'd like to associate
that template from the Archive Type: menu. Then click
Movable Type allows you to extract common chunks of HTML code into templates
that you can then include in your other templates; in Movable Type, these
common templates are called
Template Modules. An example of the use for
such a template might be a header that you use throughout your site. You
can create a new template module called
Header, paste in the common header
code, then save the new template. You can then include this code in all of
your other templates using the
This tag will be replaced by the contents of the
Header custom template.
This allows you to keep all common code in one place, so that if you need to modify it, you only need to modify it in one place.
These are the templates that don't fit as Index Templates, Archive Templates, or Custom Templates. Currently, the templates in this category are:
The Comment Pending Template defines the message that users see when they leave a comment that will not appear immediately. This way, they know that their comments have been received and will not keep re-posting, trying to get their comments to appear.
Uploaded Image Popup Template, an HTML file will automatically created that to contain the image in a popup window. There are three template tags that you can use in this template:
After selecting a template to edit in the
List & Edit Templates
screen--either by clicking on the name of an index template or a template
module, or by clicking the
EDIT button for the archive or miscellaneous
templates--you will be presented with the
Edit Template screen. Depending
on the type of template you are editing, or whether you are editing a template
module, the template-editing screen will differ slightly in appearance. For
example, only on an
Index Template will you be able to assign an
Here are the fields you may be presented with on the
Edit Template screen:
List & Edit Templatesscreen. In addition, when including a template module using
<MTInclude>, you will need to specify the name of the template module to include; that name will be the name that you enter here.
The template name is editable only for index templates and template modules; it is assigned automatically for archive and miscellaneous templates.
The output file applies only to index templates. It can be either a relative path (eg. file.html), in which case it is relative to your Local Site Path, or a full path rom the root of the filesystem (eg. /full/path/to/file.html).
Thus, you can use this option to turn off automatic rebuilding for an index template. If you turn off automatic rebuilding, the ONLY WAY to rebuild the index template is to click on its name in List & Edit Templates, then click the REBUILD button below the text-editing box. This will force a rebuild of the particular index template.
The value of the linked filename should be either a full path on the
filesystem to your external file, or a path relative to the
Local Site Path
for your weblog. The file extension cannot be: .cgi, .pm, .pl, or
.cfg, for security purposes, and so you do not overwrite your Movable Type
program files. For example, if you would like to maintain your
template through an external editor, you might set the linked file to
index.html.tmpl. You can then edit this file externally and save it to your
webserver; when you rebuild, Movable Type will grab the latest version of the
linked file index.html.tmpl and use that as the template (it will also
update the copy of the template in the Movable Type database, so that the next
time it needs the template, it can use the version in the database).
NOTE: when you create a new template without specifying a template body, and link it to a file that already exists, the contents of that file will be pulled in to the template. If you do specify a template body, however, and the linked file already exists, that linked file will be overwritten with the template body you specified.
Linking a template to an external file is optional; you are free to maintain all of your templates through the Movable Type application itself, if you wish.
Movable Type ships with a set of default templates that are customizable through stylesheets; the same template markup can be made to look completely different by inserting a new stylesheet. You can view the default templates themselves at http://www.movabletype.org/default_templates.shtml .
To select a new style for your weblog, follow these instructions:
List & Edit Templates.
Stylesheet; open this template for editing.
Template bodybox of the template you opened for editing in Step 2.
SAVEbutton to save the new stylesheet.
Rebuild Indexes Onlyfrom the pulldown menu, and click the
NOTE: some browsers (Internet Explorer for Windows, for one) refuse to reload a stylesheet from the webserver once they have fetched it once; if, when you view your site, nothing has changed, you should empty your browser cache and try again.