Community Central

READ MORE

Community Central
Advertisement
This extension is enabled by default on Fandom.

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

Step by step

Syntax

The extension brings the following set of tags to customize your own random selection:

  • The <choose> tag is the parent tag of the set.
    • The uncached attribute disables caching. Used as <choose uncached>.
    • The before attribute adds text before the option. Used as <choose before="Text before"> (accepts wikitext).
    • The after attribute adds text after the option. Used as <choose after="Text after"> (accepts wikitext).
  • The <option> tag is chosen between all the used option tags, and it will show its contents. You can add links, images and even templates.
    • The weight attribute defines the weight of the option, which is 1 by default, if you want it to have more chances to appear. Used as <option weight="Number"> (only accepts numbers, and decimal values are ignored).
  • The <choicetemplate> tag can make that what's inside the <option> tags is sent as a template argument.

It also brings a parser function called #choose, which accepts links, images, and even templates. Used as:

{{#choose:
 |Option 1
 |Option 2
 |More options...
}}

Examples

Basic usage is like this:

<choose>
 <option>Option 1</option>
 <option>Option 2</option>
</choose>

It's also possible to use the before and after attributes of the <choose> tag to add random videos, using EmbedVideo for example (where VideoIDn is a Youtube video ID):

<choose before="{{#ev:youtube|" after="}}">
 <option>VideoID1</option>
 <option>VideoID2</option>
 <option>VideoID3</option>
</choose>

The example below will display a flag image icon:

<choose>
 <option>[[File:Icon-German.png|18px]]</option>
 <option>[[File:Icon-English.png|18px]]</option>
 <option>[[File:Icon-Spanish.png|18px]]</option>
 <option>[[File:Icon-Finnish.png|18px]]</option>
 <option>[[File:Icon-French.png|18px]]</option>
 <option>[[File:Icon-Italian.png|18px]]</option>
 <option>[[File:Icon-Japanese.png|18px]]</option>
 <option>[[File:Icon-Korean.png|18px]]</option>
 <option>[[File:Icon-Dutch.png|18px]]</option>
 <option>[[File:Icon-Polish.png|18px]]</option>
 <option>[[File:Icon-Portuguese.png|18px]]</option>
 <option>[[File:Icon-Russian.png|18px]]</option>
 <option>[[File:Icon-Vietnamese.png|18px]]</option>
 <option>[[File:Icon-Chinese.png|18px]]</option>
</choose>

The above example results in the following:

Icon-Dutch.png

See also

Further help and feedback

Advertisement