Not a developer? Go to MovableType.com

Plugin and Theme Directory

Compare v1.1

By
Posted December 5, 2002, in MT Tags, Templates, Widgets.

Details

This Movable Type plugin implements a set of template tags for displaying a portion of a template conditionally, depending on the results of a comparison between values. The values compared can be literal strings or numbers, or they can be pieces of MT template code that the plugin will build and evaluate, using the result in the comparison.

MT users have developed a number of techniques in PHP and JavaScript to implement various useful conditional-display features on MT-based sites. The tags in the Compare plugin should let you accomplish many of these same tasks within your MT templates, without using PHP or JavaScript tricks. For example:
  • Display different text in the Comments link for each entry depending on how many comments have been posted
  • Use a different display format for entries by a particular author or set of authors
  • Within a category listing on a category archive page, display the current page's category differently from the rest
  • Display different text on an entry depending on what time of day it was entered ("morning," "afternoon," etc.)

These tags are intended for doing straight comparisons of equality and inequality. If you want to compare things against regular expressions (for instance, finding out whether a string contains another string), you should try Brad Choate's powerful and flexible Regex plugin. (The MTIfMatches tag in that plugin overlaps somewhat in functionality with the MTIfEqual and MTIfNotEqual tags in this one.)


Back