The Structure of a Plugin

First, all the files associated with a plugin should be contained within a single root folder for the plugin. The plugin's root folder can contain as many files and sub-folders as necessary to support the plugin. The plugin's root folder is then placed within Movable Type's addons folder.

If your plugin contains multiple files and support files, it is customary for those files to be placed within the following folder heirarchy:

  • MT HOME (where mt.cgi resides)
    • plugins
      • PluginName (plugin root folder)
        • mt-static (where all javascript, css and images will be placed)
        • extlib (where all external support libraries, for example required perl modules, are placed)
        • tmpl (where all template files for rendering plugin UI elements within the application are placed)
        • lib (where all plugin library files, or perl modules, are placed)
        • php (where all Smarty PHP files are placed for a plugin to support dynamic publishing are placed)
        • t (where any unit tests are placed to help validate that a plugin is functioning and is configured properly)
        • tools (where any scripts or utilities are placed)

However most plugins will not be so complicated. In fact most plugins can usually consist of a single file.

This page was last updated on 2008-02-20, 21:25.  

1 Note

I tried placing any external Perl module in an extlib subdirectory as descibed above, but it didn't work -- MT couldn't find it. When I moved into 'lib' it was able to find, but it doesn't seem to be checking for an extlib within plugin envelopes/

Leave a note

Have a question, please use the MT Forums. Notes sumbitted here should pertain to tips & hints regarding documentation.