Changes

Jump to: navigation, search

Template:Current other/doc

2,674 bytes added, 09:58, 8 June 2015
Demospace: add nowiki
{{Documentation subpage}}
{{redirect3|noquotes|[[Template:When in current version]]}}

<!-- PLEASE ADD CATEGORIES AT THE BOTTOM OF THIS PAGE -->

This is the {{tl|current other}} meta-template.

This template helps other templates detect if they are on a current version of a page or are on an old version being viewed from the revision history.

===Basic usage===
This template usually takes two parameters, like this:
: {{tlx|current other&#32;|''result if in current version''&#32;|''result if in old version''}}</pre>

If the template is on a current page, it will return this:
: {{current other |demospace=current |''result if in current version'' |''result if in old version''}}

If the template is on any other page, it will return this:
: {{current other |demospace=other |''result if in current version'' |''result if in old version''}}

A typical usage case could be to make it so that a template only displays when in the current version of an article:
: {{tlx|current other&#32;|<nowiki>{{current}}</nowiki>}}

Or to only show text in an old version of an article:
: {{tlx|current other&#32;|&#32;|This text should never appear in "live" articles.}}

Note that in the first case above the "other" parameter was not used, and in the second example the "current" parameter was left empty.

===Demospace===
For testing and demonstration purposes, this template can take a parameter named '''demospace'''.
* If it has the value '''current''' it returns the current version text.
* It if has the value '''other''' or any other value it returns the old versions text.
* If the parameter is empty or undefined, the actual page type determines the result.

Like this:
: {{tlx|current other |''result if in current version'' |''result if in old version'' |<nowiki>demospace=current</nowiki> }}

No matter on what version of a page the code above is used, it will return: {{current other |''result if in current version'' |''result if in old version'' |demospace=current }}

You can make it so your template also understands the '''demospace''' parameter. That means you can demonstrate the different appearances of your template in the documentation for your template:
: {{tlx|current other |''result if in current version'' |''result if in old version'' |<nowiki>demospace={{{demospace|}}}</nowiki>&#32;}}

===Technical details===
This template compares {{[[Help:Magic_words#Other_variables_by_type|REVISIONID]]}} to {{[[Help:Magic_words#Other_variables_by_type|REVISIONID]]:{{[[Help:Magic_words#Variables|FULLPAGENAME]]}}}} to determine whether it's being shown in the current version.

<!-- CATEGORIES BELOW THIS LINE, PLEASE: -->
[[Category:Wikipedia metatemplates]]
Anonymous user

Navigation menu