IfModified Plugin for Movable Type
Current version: 1.4 (2/23/05)
- Download (.tar.gz file)
- Plugin Code (.pl file)
- About the IfModified Plugin
- MTIfModified
- Version History
About the IfModified Plugin
Note: This plugin used to be called LastModified, and had an MTLastModified tag. Since version 2.65, Movable Type has had a built-in MTEntryModifiedDate
tag, making the plugin tag obsolete, but MTIfModified is still useful.
This Movable Type plugin implements a template tag for displaying a section of template code conditionally based on whether or not an entry was modified since it was created.
Installation
To install the IfModified plugin, upload the file IfModified.pl to the plugins directory within your Movable Type directory. If you do not already have a plugins directory, create one before uploading the file. For more information about Movable Type plugins, see the documentation.
Support
Please use the support forums for all support requests, bug reports, feature requests, questions, and comments regarding this plugin.
MTIfModified
This container tag will display its contents if the date and time an entry was modified is different from the date and time the entry was created. If the dates and times of modification and creation are identical, the tag will display nothing. It must be used within an MTEntries
container.
The following code will display an "Updated at..." line if and only if the entry has been modified since it was created:
<MTIfModified> Updated at <$MTEntryModifiedDate format="%I:%M %p on %B %e, %Y"$> </MTIfModified>
Note that if you change an entry's creation date manually, this will cause MTIfModified to think the entry has been modified, since the modification timestamp and creation timestamp will differ.
The tag takes the following attributes:
- leeway="n" (optional)
You may want to be able to fix typos or make other changes in the first few minutes after making an entry, but without the entry appearing as "updated." If you use theleeway
attribute,MTIfModified
will not display its contents if the entry was modified withinn
minutes of being created.The following code will display an "Updated at" time only if the entry was modified more than 15 minutes after being created:
<MTIfModified leeway="15"> Updated at <$MTEntryModifiedDate format="%I:%M %p on %B %e, %Y"$> </MTIfModified>
Also, some third-party MT posting tools (ecto, for instance) seem to create an entry first and then populate it a couple of seconds later, causing all entries posted this way to show up as "updated." If you're posting with such a tool, you can use
leeway="1"
to account for this.Using the
leeway
attribute requires theTime::Local
module, which is part of the standard Perl distribution.
Version History
2/23/05 - version 1.4
- Removed obsolete MTLastModified tag, renamed plugin to IfModified.
- Fixed error under some MySQL installations that return modified_on column in a non-timestamp format.
7/12/04 - version 1.3
- Plugin now registers itself with MT 3 interface.
- Added $VERSION variable and package declaration.
- MTIfModified is now declared as a conditional tag, so it should work with MTElse.
1/28/03 - version 1.2
- Added
leeway
attribute toMTIfModified
(thanks to Joshua for the suggestion)
11/7/02 - version 1.1
- Added
MTIfModified
tag
11/6/02 - version 1.0 released