Not a developer? Go to MovableType.com

Documentation

The Basic Structure of a Theme

This page describes the theme framework for plugin developers.

What is Theme ?

Theme Directory

The “themes” directory is placed in the root of the MT application directory. User can use custom themes by transferring the theme files to the theme directory via FTP or other method. The theme directory is configurable by ThemesDirectory Configuration Directive.

The initial value is “themes”, so the standard themes directory is “(MT_HOME)/themes/”. When you install Movable Type, a themes directory is created. The following settings are required for the themes directory:

  • The owner of mt.cgi (apache, www-data, mt.cgi owners in the suexec environment) can read, write and list.

We also recommend the following settings:

  • Not visible from the public access on Web server.

Please refer to the documentation below to learn how to use themes.

The Differences between plugins and themes

There are two major differences.

Prohibited to include Perl code

You cannot write what’s commonly recognized as Perl code in the yaml files in the themes directory. For example, please do not include character lines that begin with “sub{“, or method calls in “$PluginFoo::PluginFoo::method” format. This is to maintain the security of users who use themes. It’s also a necessary step as we look forward to realizing automatic theme acquisition.

Load timing

Files in the themes directory are only loaded when necessary. In the plugins directory, all plugins are loaded each time MT is run, but each theme in the themes directory is loaded when users open a theme list screen. Also, when theme information is necessary while operating a blog, only that particular theme is loaded.

Blog theme and Website theme

You can create a theme for blogs, for websites or for both. It is specified by “class” attribute of the theme basic information.

Theme Registry keys

Information added to the Registry is separated into “Basic Information” for themes, and the expanded portion, “Theme Elements.”

Basic Information

Basic information includes setting information like theme name, creator name, etc. Each theme must have its respective basic information. Please refer to the page below for information on assignable values.

Theme Element

Plugin developers can use theme elements to extend the theme framework from the plugin. Theme creators can include as many Theme Elements as are required in a single theme. Define the Registry key below in each Theme Element.

importer

Required. This unique ID is used to identify Importers that are capable of importing this particular Theme Element. If this field is blank for a particular theme, attempting to load this theme will produce an error and it will be unusable.

component

This is the ComponentID of the component that provides the Importer/Exporter for this Theme Element. Some Exporters are automatically set. You may omit this.

scheme_version

This is the Theme Element’s scheme version. Define with either integers or fractions. If it is omitted, it will automatically be treated as Version 1.0. When you export a theme on the Movable Type admin screen, Exporter automatically sets the appropriate version number.

minimumimporterversion

Specify the minimum required version of Importer to import this Theme Element. If it is omitted, it will be interpreted as “0.”

require

Specify “1” if this theme element is required to use the theme. “0” is set if it’s not specified.

data

This is the content of the Theme Element. The content defined below the data is reliant on the inclusion of the Theme Element importer.

For more information about Element data processed by Movable Type CoreHandler, please see the article below.

If you use plugins to process Theme Element,the plugin must have Importer. For more information on expanding Theme Element, please see the article below.

Static Files

You can put image files used for the design of the theme (and other files) in the (THEMEHOME)/static directory. When this directory is included in Theme, MT automatically copies the content of this directory to the (SupportDirectory)/themestatic/MYTHEME directory.

alt-tmpl directory

When the alt-tmpl directory is included in a theme, you can customize the admin screens of blogs currently using that theme. When Movable Type is displaying the admin screen, it uses this as the highest priority template. As a result, you can provide different admin screens for each theme.

Back

2 Comments

albert on December 12, 2012, 10:36 a.m. Reply

The layout of themes seems simple enough. I will try to create my own.

stephenb on December 12, 2012, 11:01 a.m. Reply

Could we get some more themes with the default installation? That would be much appreciated.