LinkEntryToFile Plugin for Movable Type
Current version: 1.1 (7/12/06)
- Download (.tar.gz file)
- Plugin Code (.pl file)
- About the LinkEntryToFile Plugin
- Movable Type Screen(s) Affected
- What You'll See
- How It Works
- Version History
LinkEntryToFile is a plugin that modifies the interface of Movable Type. When the plugin is installed, you can specify a file on your server to link to the Entry Body or Extended Entry field. The linked file will be kept in sync with the entry, so that you can edit it in an external editor.
This plugin basically takes MT's handy "Link this template to a file" feature and applies it to entries. When using MT to manage certain types of content, especially content that contains extensive HTML formatting, it's useful to be able to use your favorite text-editing application, with syntax highlighting, Undo, search and replace, etc., without having to repeatedly copy and paste into the MT entry screen.
This version of LinkEntryToFile requires Movable Type 3.3.
To install the LinkEntryToFile plugin, upload the file
LinkEntryToFile.pl to the
plugins directory within your Movable Type directory.
LinkEntryToFile is available free of charge under a Creative Commons license.
Please use the support forums for all support requests, bug reports, feature requests, questions, and comments regarding this plugin.
- Create New Entry
- Edit Entry
When LinkEntryToFile is installed and you edit an entry, if the plugin is enabled for the current weblog, you'll see a field labeled
Link Entry Body to a file: below the Entry Body field, and (if your preferences are set to display the Extended Entry) a field labeled
Link Extended Entry to a file: below the Extended Entry field.
To link an entry's body or Extended text to a file, enter the path and filename in the appropriate "Link to a file" field, then save the entry. This can either be an absolute path to a file on your server, beginning with
/, or a path relative to the
Local Site Path of the weblog to which the entry belongs.
For security reasons, the filename must have an allowed extension. By default, the following extensions are allowed:
.txt .text .html .htm .shtml .ssi
With MT 3.2, you can modify this list for an individual weblog or across the whole system by changing the LinkEntryToFile Settings. With MT 3.1x, you'll have to edit the
$allowed_ext string defined at the top of
When you enter a filename and save the entry, what happens depends on whether the file already exists and whether you've entered any text in the field:
- If the file already exists and you've left the entry text field blank, the contents of the file will be loaded into the field.
- If the file already exists and there's text in the entry text field, the file will be overwritten with the contents of the field.
- If the file does not exist, it will be created and filled with the contents of the entry text field.
If the file cannot be read or written, or the filename doesn't have one of the allowed extensions, it should not affect the saving of the entry, but you'll see an error message above the "Link to a file" filename in question.
Once an entry field is linked to a file, whenever the entry is loaded, the plugin will check to see if the file has been modified, and if so, it will load the file's contents into the field. This means you can edit the file however you wish, and the changes will be reflected when you rebuild a page containing the entry.
You can set options for LinkEntryToFile across all weblogs or for individual weblogs. LinkEntryToFile has the following settings:
- Enable: (weblog-specific only) Uncheck this box to disable entry linking for a particular weblog.
- Extensions: This list of filename extensions, separated by a space (and without a period), controls what types of files can be linked to entry fields.
To change the settings globally, click on
Plugins on the
System Overview screen, or under
System Shortcuts on the Main Menu. Find the LinkEntryToFile plugin in the listing and click
To change the settings for a specific weblog, go to that weblog's
Settings screen and click the
Plugins tab. Find the LinkEntryToFile plugin in the listing and click
6/28/06 - version 1.1
- Updated code for MT 3.3
7/22/05 - version 1.01
- Fixed config template subroutine for a change in MT 3.2b2
7/21/05 - version 1.0 released