Knowledge Base / Appnel Solutions 

Last Modified
26 September 2007 @ 8pm

Gizmos for Movable Type

NAME

Gizmos for Movable Type - An eclectic grouping of tiny yet helpful template tags, modifiers and text filters.

VERSION

2.0

SYSTEM REQUIREMENTS

The current release of Gizmos for MT requires Movable Type version 4.01 or better. Gizmos for MT will load and perform as expected using MT 4.0; however, a bug in that version does impact the operation of the "is active" template tags.

TAGS

Entry

  • mt:entryauthornicknamelink**

    A tag that inserts and links the nickname of an entry's author rather then the author's login name as does the c tag.

    If the author's profile contains a web URL, the link will be to that URL. If no URL was provided, but an email address was, the link will be a mailto: link to that email address. If neither an email address or URL was provided, then the nickname will not be linked.

    Like the built-in c, you can use the c attribute to encode the author's email address to provide some protection against spam.

  • mt:entrybodymore

    A tag that outputs both the entry body and more fields with one tag. Includes an fragment marker so a permalink can be generated the will scroll the browser down past the content of the entry's body.

  • mt:entrycategoryis (id="" or label="")

    A conditional tag that will render its contents if the primary category of the entry in context matches the category defined by either the id or label argument.

  • mt:entryifexcerpt**

    A conditional tag whose contents will be displayed if an entry has an excerpt.

  • mt:entryisnew [days="" or lastn_minutes=""]

    A conditional tag that displays its contents if the entry in context has been published in some recent time period defined by either a days or lastn_minutes attribute. If neither are present a default of 7 days is used.

    NOTE: Being statically published this conditional will not be evaluated until the page is built again.

  • mt:entryprimarycategorylink

    Outputs a permalink to the archive page for the primary category of the entry.

  • mt:entrysmartbody**

    Inserts an entry's excerpt if it has one and the post's body if it doesn't.

  • mt:entriesupdated [days="" seconds=""]

    A container tag that list entries by their modified_on timestamp. This is a convience tag that can be used in place of mt:entries sort_by="modified_on" days="". This tag does support filtering by seconds which can be used to display change of this the a day that could be helpful for very active blogs.

Page

  • mt:pageauthornicknamelink

    Operates the same as mt:entryauthornicknamelink by on a page.

  • mt:pagebodymore

    A tag that outputs both the page body and more fields with one tag. Includes an fragment marker so a permalink can be generated the will scroll the browser down past the content of the page's body.

  • mt:pageifexcerpt

    A conditional tag whose contents will be displayed if an page has an excerpt.

  • mt:pageisnew [days="" or lastn_minutes=""]

    A conditional tag that works mt:entryisnew, but for pages.

    NOTE: Being statically published this conditional will not be evaluated until the page is built again.

  • mt:pagesmartbody

    Inserts an page's excerpt if it has one and the page's body if it doesn't.

  • mt:pagesupdated [days="" seconds=""]

    A container tag that list entries by their modified_on timestamp. This is a convience tag that can be used in place of mt:pages sort_by="modified_on". This tag does support filtering by seconds which can be used to display change of this the a day that could be helpful for very active blogs.

Comment

  • mt:commentatomid

    Generates a Atom Syndication Format identifier similar to the built-in mt:entryatomid. Handy for generating comment feeds in Atom.

  • mt:commenterisauthor

    A conditional tag that displays its contents based on a comparison of the commenter and entry/page author's email address.

  • mt:commenterisblogauthor

    A conditional tag that displays its contents based on a comparison of the commenter and a list of associated author's email addresses. Permisions are not considered in this list.

  • mt:commentidentifier

    Outputs an identifier made up of the comments system id prefixed with a 'c'. This is most helpful with an HTML id attribute and the mt:commentpermalink tag.

  • mt:commentisnew [days="" or lastn_minutes=""]

    A conditional tag that works mt:entryisnew, but for comments. If neither days or lastn_minutes are present a default of 1 days is used.

    NOTE: Being statically published this conditional will not be evaluated until the page is built again.

  • mt:commentpermalink

    Outputs a permalink for the comment in context based on its parent -- an entry or page.

    For example on an entry with a permalink of http://example.com/cat/post.html this tag would generate a comment permalink like http://example.com/cat/post.html#c40 where the comment id in the system is 40.

ID

  • mt:blog id=""

    Creates a context to the identified weblog via a required id argument.

  • mt:category id="" or label="" or basename=""

    Creates a context to the identified category. Takes an argument of either id or label. Selecting by label can only be applied to the current weblog in context. This limitation does not apply to id because that value is guaranteed to be unique across the entire system and not just one weblog.

  • mt:comment id=""

    Creates a context to the identified comment via a required id argument.

  • mt:entry id="" or basename="" or title=""

    Creates a context to the identified entry. Takes an argument of either id, basename or title. Selecting by basename or title can only be applied to the current weblog in context. This limitation does not apply to id because that value is guaranteed to be unique across the entire system and not just one weblog.

  • mt:ping id=""

    Creates a context to the identified ping via a required id argument.

Counts

  • mt:countheading class_type=""

    Outputs the object count as a grammatically correct string by combining the count and count label like mt:countlabel as one tag.

  • mt:countisone class_type=""

    A conditional tag that displays its contents if the count of the class_type is zero. This tag is context sensitive and will adapt according to its placement.

    This tag follows the same context evaluation progression as

  • mt:countiszero class_type=""

    A conditional tag that displays its contents if the count of the class_type is zero. This tag is context sensitive and will adapt according to its placement.

    The class_type is based on the identifier all MT::Objects must define. This value is the same one used to look up a package name using the model method found in the MT class.

    In determining its context the tag will perform the following evaluations:

    • If the class_type is NOT a value of 'entry' or 'page' the tag will return a count related to the entry.
    • The tag will next check if it is in the context of an entries or pages list and count the defined class_type based on that collection.
    • As a final option, the tag will base its count on the blog in context.
  • mt:countlabel class_type=""

    Outputs an object's defined singular or pural form based on the count that is in context.

  • mt:imagecount

    This variable tag will output the image count of the body and extended body of the entry or page in context.

  • mt:wordcount

    This variable tag will output the word count of the body and extended body of the entry or page in context.

Is Active

  • mt:archivetypeisactive type=""

    A conditional tag that will render its contents if the template is of an archive type that matches the type argument name.

  • mt:categoryisactive

    A conditional tag that will render its contents if the category in context matches either the archive category or the category of the entry in context.

  • mt:entryisactive

    A conditional tag that will render its contents if the entry in context matches the archive entry.

  • mt:folderisactive

    A conditional tag that will render its contents if the folder in context matches either the archive folder or the folder of the page in context.

  • mt:indexisactive template=""

    A conditional tag that will render its contents if the page is an Index template and its name matches the template argument.

  • mt:pageisactive

    A conditional tag that will render its contents if the page in context matches the archive page.

Other

  • mt:alternator [key="" odd="" even=""]

    Alternates between odd and even values each time it appears. All additional arguments are optional.

    • key

      This optional argument allows the system to track multiple alternators if necessary. In order to increment a specific alternator simply use the same key. If a key is not defined the plugin uses the default identifier.

    • odd

      This optional argument sets the value to return when the alternator is on. If undefined the default is odd.

    • even

      This optional argument sets the value to return when the alternator is off. If undefined the default is even.

  • mt:archivedateheader

    This container tag only works within an mt:archivelist tagset. If you try and use it elsewhere, you’ll receive an error.

    If you use monthly archives, the contents of this container will only be printed when a new year starts.

    If you use weekly archives, the contents of this container will only be printed when a new month starts.

    If you use another sort of archive, the contents of this tag will always be ignored.

  • mt:asjsinclude

    A container tag that encodes and wraps its contents in a JavaScript document.write statement. This is allows you to dynamically include content without the use of server side includes (SSI).

  • mt:autotitle [reverse="1" glue=""]

    Inserts a title constructed from the current context. This tag takes two optional arguments.

    • reverse

      By default the mt:autotitle tag orders its element from most specific to least specific. Specifying reverse with a true value (1) will reverse the order of the elements used in generating the title from least specific to most specific. The default is false (0).

    • glue

      This optional argument specifes the string to use when joining the elements together to form the title. By default the tag uses < the less then character.

  • mt:block

    This container tag does nothing itself; however, it can be used to apply modifiers to any arbitrary block of markup or text.

  • mt:htmlencodeblock

    A container tag that allows the encode_html modifier to be used on any block of markup or text.

  • mt:link [blog_id=""]

    Overloads the built-in mt:link tag to enable linking to templates, entries and pages in other blogs in a less verbose fashion.

    These two examples are essentially the same:

      <$mt:link template="Main Index" blog_id="40"$>
    
      <mt:blog id="40"><$mt:link template="Main Index$></mt:blog>
  • mt:xmlencodeblock

    A container tag that allows the encode_xml modifier to be used on any block of markup or text.

Deprecated

  • mt:entrycommentcountisone

    DEPRECATED. Use mt:countisone class_type="comment" instead.

  • mt:entrycommentcountiszero

    DEPRECATED. Use mt:countiszero class_type="comment" instead.

  • mt:entrycommentcountlabel

    DEPRECATED. Use mt:countlabel class_type="comment" instead.

  • mt:templatecomment

    DEPRECATED. Use mt:ignore instead.

MODIFIERS

  • camel_case

    Converts text into a camel-cased word such as camelCasedWord.

  • cpaned

    Converts text into a CPAN style file name. Spaces and double colons are converted to dashes. All other non-word characters are stripped.

  • encode_csv

    Converts text into comma seperated value (CSV) safe text.

  • dashify

    Like the buit-in dirify modifiers, but with dashes.

  • double_spaces**

    Converts multiple spaces to non-breaking spaces so they'll display properly in HTML.

  • plain_xml

    Strips HTML then XML encodes the resulting text.

  • real_spaces

    Converts the underscore character to an actualy space.

  • strip_whitespaces

    Removes any leading or trailing whitespace.

  • trim_to_proper

    Trims a string to the number of characters passed in and automatically appends "..." if the string is longer then the value provided.

  • wiki_case

    Converts text into a wiki-cased word such as WikiCasedWord.

TEXT FORMATTING

  • Preformatted Text

    A simple text formatting engine which wraps the entry text in HTML <pre> tags and encodes any special charcters with MT's built-in encode_html filter.

INSTALLATION

To install the plugin, simply place the files in the plugins directory into your MovableTypeHome/plugins/ directory. If the plugins directory does not exist, you need to create it.

LICENSE

The software is released under the Artistic License. The terms of the Artistic License are described at http://www.perl.com/language/misc/Artistic.html.

AUTHOR & COPYRIGHT

** - Tags and modifiers originally developed and copyright 2002 by Adam Kalsey, The Kalsey Group.

Except where otherwise noted, Gizmos for MT is copyright 2002-2007, Appnel Solutions.


 

Submit Feedback on This Article

Your comments on how we can improve this article are appreciated. Please do not use the feedback form to submit support requests or question. We will not respond to or publish such queries submitted through this form.

Back to Home