Chapter 3: Templates and Layout
Reusing Template Markup with Modules
Problem
You want to reuse a piece of markup or text.
Solution
Create a template module for reuse where necessary.
Discussion
Template modules are found in your blog's template listing screen under the Modules tab. From there you can manage all existing template modules and create new ones.
Template Modules allows you to keep all common markup in one area so that modifications can be made from one place. Modules can contain bits of template tags, text, and other markup that are never directly output as a page. Instead they can be arbitrarily included into any other template, as many times as needed.
For instance, you could create a template module named "Copyright" as such:
<p>Copyright © 2002-2005. All Rights Reserved.</p>
This module is quite simple and could have easily contained any amount
of MT template tags or even other modules if appropriate. With the
"Copyright" module saved you could add template markup to include it in
every one of the weblog's templates. To include a module use
MTInclude with the module attribute.
<$MTInclude module="Copyright"$>
With this template tag in place, the contents of the Copyright module would be inserted at this point. If our module contained MT template markup, it would have been processed as if it were part of the template in which it was included.



