Include
Includes a template module or external file and outputs the result.
NOTE: One and only one of the 'module', 'widget', 'file' and 'identifier' attributes can be specified.
Attributes:
- module
The name of a template module in the current blog.
- widget
The name of the widget in the current blog to include.
- 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.
- identifier
For selecting Index templates by their unique identifier.
For application template use: identifies an application template by filename to load.
- blog_id (optional)
Used to include a template from another blog in the system. Use in conjunction with the module, widget or identifier attributes.
- global (optional; default "0")
Forces an Include of a globally defined template even if the template is also available in the blog currently in context. (For module, widget and identifier includes.)
- ssi (optional; default "0")
If specified, 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. 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. So, for example:<$mt:Include module="Tag Cloud" ssi="php"$>
This would generate the contents for the "Tag Cloud" template module and write it to a "tag_cloud.php" file. The output of the include tag would look like this:
<?php include("/path/to/blog/includes_c/tag_cloud.php") ?>Suitable for module, widget or identifier includes.
- cache (optional; default "0")
Enables caching of the contents of the include. Suitable for module, widget or identifier includes.
- key or cache_key (optional)
Used to cache the template module. Used in conjunction with the 'cache' attribute. Suitable for module, widget or identifier includes.
- ttl (optional)
Specifies the lifetime in seconds of a cached template module. Suitable for module, widget or identifier includes.
Also, other attributes given to this tag are locally assigned as variables when invoking the include template.
The contents of the file or module are further evaluated for more Movable Type template tags.
Example: Including a Widget
<$mt:Include widget="Search Box"$>
Example: Including a File
<$mt:Include file="/var/www/html/some-fragment.html"$>
Example: Including a Template Module
<$mt:Include module="Sidebar - Left Column"$>
Example: Passing Parameters to a Template Module
<$mt:Include module="Section Header" title="Elsewhere"$>
(from the "Section Header" template module)
<h2><$mt:Var name="title"$></h2>
POD ERRORS
Hey! The above document had some coding errors, which are explained below:
- Around line 33:
-
Unknown directive: =name

Matt Jacobs
December 20, 2007 7:56 AM | Reply
I'm not sure if it's supposed to, but I could not get identifier to work with multiblog using either the [mt:multiblog] tag or blogid/includeblogs in the [mt:include] tag.