Extension:RandomInclude

Introduction
RandomInclude is an extension to MediaWiki that includes in the page a text selected at random from a list.

It is based on the RandomText extension.

Features

 * Can be used inline or through transclusion.
 * Supports wikitext.

Installation

 * 1) Download RandomInclude.php and save it in the extensions directory of your wiki.
 * 2) Insert this line in the LocalSettings.php file: include_once('extensions/RandomInclude.php');

Configuration
Parser cache is automatically disabled for pages that use the RandomInclude extension. If for any reason the random text on the page only changes when you edit or purge the page, you can try disabling the cache for the whole wiki. Notice that doing this will affect the performance of the wiki.

$wgEnableParserCache = false; $wgCachePages = false; $wgCacheEpoch = wfTimestamp( TS_MW, time - 86400 ); # 60*60*24 = 1 day
 * To disable the page cache insert these lines on LocalSettings.php:
 * 1) Disable cache
 * To give the page cache an expiration time insert these lines on LocalSettings.php:
 * 1) Set cache expiration time

Inline
You can list the alternative random texts directly on the page in which they should appear:

Random quote of the day:

Absence makes the heart grow fonder.

Actions speak louder than words.

An ounce of prevention is worth a pound of cure.

Wikitext can be used here.

Through transclusion
For larger lists of random texts, it will be better to create a template with the random texts and to include it on a separate page. This way, you can read and verify all random texts. This is specially useful if the random texts can have several lines and use wiki markup.

For instance, create a template called with this content:

Absence makes the heart grow fonder.

Actions speak louder than words.

An ounce of prevention is worth a pound of cure.

Tip
Titles and Wikitext can be used here.

On the page that will show the random text, use this:

Random quote of the day:

You can even create several separate random text templates and include a random text from one of them like this:

Random quote of the day:

Alternatives

 * RandomArea
 * RandomText

Feedback
Use the discussion page for feedback, questions, feature requests and bug reports.