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]).
 * RandomSelection.php

Changelog

 * 2007-12-10 -- Updated for compatibility with MW 1.12's new parser model
 * 2008-02-23 -- Minor bugfix
 * 2008-05-08 -- Bugfix
 * 2008-07-01 -- Use ParserFirstCallInit hook if it's available
 * 2009-09-30 -- Doxygen comments added + minor tweaks
 * 2010-01-17 -- dropped backwards compatibility with old MediaWikis as per r55838 and made the extension work under PHP 5.3+

Tested

 * MW 1.16.x - --&#91;&#91;kgh&#93;&#93; (talk) 22:10, 7 June 2012 (UTC)
 * MW 1.18.x - --&#91;&#91;kgh&#93;&#93; (talk) 18:37, 7 June 2012 (UTC)