Extension:RandomSelection

The RandomSelection extension allows for randomly-generated content inside your wiki; e.g. rotating images, random greetings, etc.

Usage
To choose between one or more options, simply place each option inside an tag, like so:

This is the first choice. This is the second choice. And so on...

From each set of tags, precisely one tag will be selected at random, and its contents shown.

If you'd like some options to be shown more often than others, you can add weight to the option tags, like so:

This option will be shown twice as often as a normal option.

By default, options have a weight of 1.

This option also has a weight of 1. Fractional portions are ignored.

Anything can be placed inside of option tags: links, images, even templates. Note, however, that template arguments will not be expanded due to 2257.

Installation

 * 1) Save the souce code into a file called RandomSelection.php
 * 2) Create a folder called RandomSelection in the extensions directory of your installation (.../extensions/) and move the file RandomSelection.php into it
 * 3) Add following line in  LocalSettings.php:
 * 4) Installation may now be verified at Special:Version

Source Code
The code in this page will only work in MediaWiki 1.12 and above. ([ Alternate version for 1.5 and above]).

Changelog

 * Dec 10 07 -- Updated for compatibility with MW 1.12's new parser model
 * Feb 23 08 -- Minor bugfix
 * May 8 08 -- Bugfix
 * July 08 -- Use ParserFirstCallInit hook if it's available
 * 30 September 2009 -- Doxygen comments added + minor tweaks
 * 17 January 2010 -- dropped backwards compatibility with old MediaWikis as per r55838 and made the extension work under PHP 5.3+