Not a developer? Go to MovableType.com

Documentation

Using Shared Templates

What are Shared Templates?

Global Templates provide designers and site administrators with the means to share code and template fragments between blogs. The greatest benefit this provides is the ability for site designers to:

  • make changes across an unlimited number of blogs and web sites by editing a single template

Editing Shared Templates

The Movable Type contains a menu on the system dashboard called “Design.” From this menu designers can quickly begin editing the templates that are shared across your entire system.

The core Movable Type product offers the following global template types:

  • Shared Template Modules - templates that contain HTML and content that can be shared across all of the blogs and sites within the system.

The Movable Type Community Solution offers the following global template types in addition the core ones:

  • Shared Widgets - templates that define the behavior of widgets that can be shared across all blogs and sites in the system.
  • Shared System Templates - template that define the look and feel for screens such as login, registration, registration confirmation, profile editor, profile display and more.
  • Email Templates - templates used in producing emails sent by the system to readers and administrators.

Community Solution users wishing to learn more about Email Templates see “Customizing Emails.”

Including Shared Templates

Including a shared template in a blog template is as simple as using the <mt:include> template tag in wide use through out Movable Type.

When processing a template include Movable Type will first search the local blog context for a module (or widget) of the name provided. If a template with that name cannot be found, then Movable Type will search the shared template modules (or widgets) for a template of that name. If it is found then Movable Type will use that template, otherwise the system will output an error saying “Template could not be found.” For example:

 <mt:include module="Sidebar">

Explicitly Selecting a Global Template Module

There could be a circumstance when a designer wishes to use a system template of a given name even though a template with the same name exists locally. To forcibly include the system template as opposed to the blog template, then the designer can use <mt:include>’s global attribute to override the default include search behavior. For example:

 <mt:include module="Sidebar" global="1">

Note: The global attribute replaces the system attribute that was used in early versions of Movable Type 4.

Overriding a Global Template Modules

Suppose you hosted a system with 100 different blogs that all shared the same search box. The code and HTML for displaying that search box across all of those blogs was found in a shared template module called “Search Box.” Then one day you had the need to customize the search box on just one of those blogs (let’s call it “My Blog”), but you didn’t want to have to re-implement all of the templates within My Blog just to customize such a small element.

Therefore to customize the “Search Box” module on just the blog “My Blog” you would create a new template module within My Blog that had the same name as the global template module you wanted to override, in this case “Search Box.”

Back