Chapter 11: Advanced Topics
Developing with the Movable Type Perl API
Problems
You want to extend Movable Type and develop an extension to the base system.
Solutions
Six Apart provides numerous resources to get you started with developing including tutorials and MT source code documentation.
Discussion
Movable Type's open code base and APIs (Application Programmers Interface) make the browser-based tool quite flexible and easily modifiable, allowing it to adapt to any number of publishing applications. Here are some pointers to that will get you started.
Perl API
The Movable Type code is written in an object-oriented style and contains a well-documented Perl API that you can use in your own Perl programs. The documentation itself is in POD format and is contained within the .pm files. You can read this documentation from the shell using the perldoc command. For example:
% cd <movable type directory>/lib
% perldoc MT
Plugins API
A plug-in is a piece of software that extends the Movable Type publishing platform in one of a number of ways. A plug-in can create new Movable Type template tags or global filters, process entry text when it is being built, and install call-backs to process objects whenever database events occur.
Writing plug-ins requires some knowledge of Perl in addition to PHP for dynamic publishing plug-ins. Plug-in code can take advantage of the full range of the Movable Type API and any external libraries such as those found at Comprehensive Perl Archive Network (CPAN).
See "How to Write a Plugin" primer to get started.
PHP Plugins API
Movable Type's dynamic publishing mode supports plug-ins as well. The architecture is different, but should be familiar in some respects.
Two key components to the PHP-based dynamic publishing engine are the Smarty template package and Justin Vincent's ezSQL library.
The php subdirectory under Movable Type's main directory contains all the files and resources related to the dynamic publishing engine:
mt/php/
lib/ Native MT tags and modules
extlib/ Third-party packages (ezSQL and Smarty)
plugins/ Third-party MT/PHP plug-ins
Plug-in files should be placed in the plugins directory. To develop MT/PHP plug-ins, you should familiarize yourself with creating add-ons for Smarty. Custom blocks, functions, and modifiers are the basis for adding container tags, variable tags and global filters respectively for MT/PHP.
See the overview of the dynamic publishing architecture for more..
For more information on creating custom plug-ins for MT's PHP layer, refer to this article on our ProNet site.
There is also a wealth of information on how to write Smarty routines on the Smarty web site.



