Extension:Loops

What can this extension do?
While and do-while loops similar to those used in programming languages.

Syntax
By quirk or design, the preprocessor in v1.12alpha handles the first parameter differently than the rest, so the parser functions ignore it in order for them to work. See bug 12842.

#while
{ {#while}} performs a loop (i.e. it repeatedly parses a given wiki markup block statement) so long as the condition mark-up evaluates to non-whitespace.

The wiki markup:

produces the following:


 * 0
 * 1
 * 2
 * 3
 * 4

#dowhile
{ {#dowhile}} performs exactly like { {#while}}, with the exception that the block statement is guaranteed to be parsed and displayed (if it results in displayable text) at least once. This done before the condition text is evaluated.

Download instructions
Please cut and paste the code found below and place it in. Note: $IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php.

Installation
To install this extension, add the following to LocalSettings.php:

ExtLoops::$maxLoops
This parameter set the maximum number of loops a page is allowed to perform. Setting it to a negative value lets the loops run within the limits of php's environment.