Includes the contents of a template module or external file into the current template where is it used.
Note: One of the following attributes is required and not more than one may be used:
<$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.
<mt:SetVarBlock name="cache_key"><mt:EntryCategory></mt:SetVarBlock> <$mt:Include widget="Related Entries" key="$cache_key" ttl="3600" cache="1"$>
cache for example.
NOTE: In Movable Type 5.13, 5.07, 4.38, and later versions, this attribute is disabled in default settings. You can enable it by specifying AllowFileInclude configuration directive.
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.
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"$>
Forces an Include of a template in the parent website. Default value is “0”.
<$mt:Include module="Sidebar" parent="1"$>
For selecting Index templates by their unique identifier.
The name of a template module in the current blog.
For application template use: identifies an application template by filename to load.
Causes the include to be handled as a server-side include. Default value is “0”. If “1” is specified instead, mt:Include tag generates a SSI file with the format which you set in the blog settings ( [Settings] > [General] > Module Settings ).
For example if you have set it to “PHP Includes”
<$mt:Include module="Tag Cloud" ssi="1"$>
This tag outputs a php include tag:
<?php include("/path/to/blog/includes_c/tag_cloud.php") ?>
Specifies the lifetime in seconds of a cached template module. Suitable for module, widget or identifier includes.
cache for example.
The name of the widget in the current blog to include.
<$mt:Include widget="Search Box"$>
Also, other attributes given to this tag are locally assigned as variables when invoking the include template.
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>
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: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>