Learning Movable Type: An Overview of the MT Program File Directories


What do all these folders do?

This tutorial is written by LMT contributor Arvind Satyanarayan of Movalog.

There are several folders in the default distribution of Movable Type. This tutorial will attempt to guide you through them all so that you feel more comfortable with what they do and contain.

extlib/

This directory contains perl libraries and files that support Movable Type. These are the modules that are needed by Movable Type to run (for example those modules listed in mt-check.cgi are normally found here) Some plugins also require some special perl modules to be installed, and normally you can install these perl modules into the extlib/ directory. For example, the BlogTimes plugin requires the GD perl module to be installed. Obviously you can get your host to install it and then that module would be available server wide. However, if you uploaded the files provided on the BlogTimes page into your extlib/ directory, you would have the GD module installed just for your installation without having to go to your host.

The extlib/ directory, however, can't handle everything. Many modules still need to be installed by your host for example Image::Magick or the Storable module can't be installed into the extlib/ directory as they require compilation.

You should never have to change the contents of files located in this directory if you ever apply a hack.

lib/

This contains your core Movable Type files. These files are Movable Type, they are what run the different processes for example rebuilding, commenting etc. Everything you see in the Movable Type interface and everything that Movable Type does is defined here in perl. Within lib/, we have a few more directories.

lib/MT/

This subdirectory inside lib/ contains the MT API and several subdirectories that directly control Movable Type. The files in lib/MT/ are known as the MT API (or Application Program Interface). These files allow things to interact with Movable Type and its database, this includes the actual core MT files or a desktop client like w.bloggar.

lib/MT/App/

The most important directory is App/. The App/ directory contains perhaps the most important files in Movable Type. These files define Movable Type and how it works. Most of your hacks will be changing the files in this directory. It also contains default-templates.pl, as the name suggests, this file is called and its values define the default templates when you either create a new blog or reset templates in an existing blog.

lib/MT/FileMgr/

As the name suggests, this folder contains the perl module responsible for all physical files generated by MT whether it be static entry pages, templates or HTML files generated by selecting the popup attribute in the upload dialog. Changes to this file will affect the files generated by MT.

lib/MT/L10N/

L10N (or l10n as you mostly see it as) is another way of saying localization -- the term l10n is formed by the first and last letter of the word and the number of letters in between. This directory contains all your language modules used when building the MT interface. For example the English distribution of Movable Type will contain en_us.pm that will render the Movable Type interface in English.

lib/MT/ObjectDriver/

The files and folders under this directory allow MT to interact with its database. In the default installation, you have modules allow MT to interact with Berkely DB, mySQL, PostgreSQL and SQL::Lite. If you wanted to use another database, the first thing you would need to do is create a file in this directory to correspond to your database type.

lib/MT/Template/

The name of this folder gives you a clue to what it does. The file in here defines the template tags available by default in Movable Type. If you wanted to add a tag into MT without writing a plugin, you would need to do it here.

plugins/

This folder may not exist on your server and will need to be created if you ever install a plugin.

schemas/

This folder contains files used during mt-load.cgi to create the database, tables, relationships etc. Again if you wished to have MT interact with another database, you would need to create a schemas to load the MT database into it.

search_templates/

As the name suggests, this folder contains the templates used by MT when a search is performed. You can learn more about using search templates here

tools/

This folder contains scripts that can be run outside of MT to interact with MT. An example would be the run-periodic-tasks file. This file can be used in a cron command to run the scheduling posting script. Similarly other scripts can be cronned and used.

examples/

This folder contains some sample plugins by Ezra that basically highlight the new plugin architecture in Movable Type 3.

php/

This directory contains all the PHP files for the dynamic templating system introduced in Movable Type 3.1. Within it there are three folders, extlib/, lib/ and plugins/ and function exactly as their perl counterparts. extlib/ contains the Smarty templating and other PHP files to create a PHP instance of Movable Type and interact with the database. The lib/ directory contains all the PHP ports of the template tags while the plugins/ directory will contain PHP plugins.

docs/

This directory contains html files and images that is basically your copy of the MT Manual. Its pages are referenced throughout MT with the little Question Mark in a box. If you have installed MT in your cgi-bin/ you will need to move this folder out of it, in a StaticWebPath.

images/

This directory contains images used by MT in the web based interface (mt.cgi) This will also need to be in your StaticWebPath if you have installed MT in your cgi-bin/


Posted by Arvind Satyanarayan on February 3, 2005 12:36 AM to Learning Movable Type http://www.learningmovabletype.com/