Knowledge Base / The Appnel Group 

Last Modified
30 January 2008 @ 11am

Again for Movable Type Manual

NAME

Again for MT - enables a generic means of performing a recursive loop on some template markup

SYNOPSIS

  <mt:again limit="5">
  <a href="<$mt:archivelink$>"><$mt:archivetitle$></a><br />
  <mt:archiveprevious>
    <$mt:againhere$>
  </mt:archiveprevious>
  </mt:again>
    

DESCRIPTION

Again for MT - enables a generic means of performing a recursive loop on some template markup.

Wikipedia defines recursion in mathematics and computer science as "a method of defining functions in which the function being defined is applied within its own definition." The entry continues "For instance, when the surfaces of two mirrors are almost parallel with each other the nested images that occur are a form of recursion."

http://en.wikipedia.org/wiki/Recursion

This MT4 plugin is based on an MT3 plugin originally developed by LummoxJR.

One such use of recursion in MT templates is calling a functional block tag like recursively to show the previous 5 entries to the one in context. See the SYNOPSIS for a specific example in code.

TAGS

mt:again [limit="5"]

A container tag that defines the block to repeat when recursing. Take one optional argument that defines the maximum depth (number of loops) of the recursion process. The default limit is 50. In order to avoid a potential server crashing infinite loop from potentially occurring the maximum limit supported is 50. Setting a limit higher then 50 will be ignored.

mt:againhere

A variable tag representing the point at which the recursion loop takes place again.

mt:againstop [any="1"]

This block tag is an alternative to that can be used when you want to recurse up to a certain point (depth/limit) and then do something. The contained markup is output when the limit defined in is reached.

The tag takes an option any argument will make the contents appear at the deepest point reached by recursion -- regardless if the limit could be reached. An example would be using and running out of entries before the limit is reached.

SUPPORT

Support issues should be directed to the Movable Type Community Forums at http://community.movabletype.org/.

AUTHOR

Timothy Appnel

COPYRIGHT AND LICENSE

This MT4 plugin is based on an MT3 plugin originally developed by LummoxJR.

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. Except where otherwise noted, Again for MT is Copyright 2008, Timothy Appnel, The Appnel Group, http://appnel.com/. All rights reserved.


 

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