Release status: beta |
|
|---|---|
| Implementation | Tag |
| Description | Inserting random elements in a page |
| Author(s) | Thomas Stock |
| Latest version | 2.0.0 (2018-03-29) |
| MediaWiki | 1.29+ |
| Database changes | No |
| License | Creative Commons Attribution NonCommercial Share Alike 2.5 |
| Download | Download extension Git [?]: |
|
Hooks used
|
|
| Quarterly downloads | 0 |
| Translate the RandomArea extension if it is available at translatewiki.net | |
The RandomArea extension allows for displaying or including a selected number of random elements from a list on a page.
Note: I was inspired by the RandomText extension to write this, thanks to Martin Rohrbach.
Installation
- Download and place the file(s) in a directory called
RandomAreain yourextensions/folder. - Add the following code at the bottom of your LocalSettings.php file:
wfLoadExtension( 'RandomArea' );
Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.
To users running MediaWiki 1.28 or earlier:
The instructions above describe the new way of installing this extension using wfLoadExtension().
If you need to install this extension on these earlier versions (MediaWiki 1.28 and earlier), instead of wfLoadExtension( 'RandomArea' );, you need to use:
require_once "$IP/extensions/RandomArea/RandomArea.php";
Usage
Insert the lines you want to be randomized and enclosed in <randomArea>...</randomArea> tags; for example:
<randomArea > Klaus Mark Otto </randomArea>
Only displays one of the following names: {Klaus, Mark, Otto}
You can use this to include patterns or pages.
<randomArea >
{{Template:Aaa}}
{{:Patterns:Aab}}
</randomArea>
You can alternatively add some attributes to the element to save and view letters.
<randomArea include="1" nsPrefix="MyRandPrefix:" count="2" > Klaus Mark Otto </randomArea>
This chooses two of the elements and includes them from the given namespace. It is equivalent to:
<randomArea count="2" >
{{:MyRandPrefix:Klaus}}
{{:MyRandPrefix:Mark}}
{{:MyRandPrefix:Otto}}
</randomArea>