Difference between revisions of "User:Kevincox/Random"
(Added description.) |
|||
Line 3: | Line 3: | ||
</includeonly> | </includeonly> | ||
<noinclude> | <noinclude> | ||
+ | |||
+ | {{Doc begin}} | ||
+ | |||
+ | This template will select a random item from the list of items passed in and "return" it. Effectively including one of the passed in items at random. | ||
+ | |||
+ | === Syntax === | ||
+ | |||
+ | <nowiki> | ||
+ | {{User:Kevincox/RandomQuote|3 | ||
+ | |{{Quotation|'''The Medic''', making preparations|... Let's go practice medicine.|sound=LetsGoPracticeMedicine.wav}} | ||
+ | |{{Quotation|'''Kevin Cox''', writing a template|Please work!.}} | ||
+ | |{{Quotation|'''Kevin Cox''', running out of things to say.|Ummm...}} | ||
+ | }} | ||
+ | </nowiki> | ||
+ | |||
+ | The first argument is the number of items and the rest of the arguments are the items themselves. Below is the above example. | ||
{{User:Kevincox/RandomQuote|3 | {{User:Kevincox/RandomQuote|3 | ||
Line 9: | Line 25: | ||
|{{Quotation|'''Kevin Cox''', running out of things to say.|Ummm...}} | |{{Quotation|'''Kevin Cox''', running out of things to say.|Ummm...}} | ||
}} | }} | ||
+ | |||
+ | === Updating Notes === | ||
+ | Because Mediawiki caches pages to improve performance the template will only update when the page is purged, this happens when a page, or any templates on a page are edited. The cache is also invalidated and purged every <code>$wgParserCacheExpireTime</code> seconds see [[https://www.mediawiki.org/wiki/Manual:Configuration_settings#Parser_Cache this page]] for more info. | ||
</noinclude> | </noinclude> |
Revision as of 16:40, 28 November 2012
Documentation for Kevincox/Random
This template will select a random item from the list of items passed in and "return" it. Effectively including one of the passed in items at random.
Syntax
{{User:Kevincox/RandomQuote|3 |{{Quotation|'''The Medic''', making preparations|... Let's go practice medicine.|sound=LetsGoPracticeMedicine.wav}} |{{Quotation|'''Kevin Cox''', writing a template|Please work!.}} |{{Quotation|'''Kevin Cox''', running out of things to say.|Ummm...}} }}
The first argument is the number of items and the rest of the arguments are the items themselves. Below is the above example.
“ | Ummm...
— Kevin Cox, running out of things to say.
|
” |
Updating Notes
Because Mediawiki caches pages to improve performance the template will only update when the page is purged, this happens when a page, or any templates on a page are edited. The cache is also invalidated and purged every $wgParserCacheExpireTime
seconds see [this page] for more info.