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. Anything can be placed inside of option tags: links, images, even templates. Note, however, that template arguments will not be expanded due to 2257.

Weight
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.

You can also have what is placed inside the option tags be sent as an argument to a template, e.g.:

Choice templates
Template:Featured article/Elephant Template:Featured article/Giraffe Template:Featured article/Rhinoceros PageWithEditButton

You could then create a Template:PageWithEditButton with these contents: [ Edit]

This is useful if you want to set up randomly rotating featured articles and have an edit button to allow the user to edit the featured article blurbs.

Installation

 * 1) Save the source 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

 * 2012-09-02 -- Added  functionality
 * 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.19.x - --Leucosticte (talk) 21:58, 2 September 2012 (UTC)
 * 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)