Template:Current other

From EUSwiki
Jump to: navigation, search


50px Template documentation[view] [edit] [history] [purge]

Template:Redirect3


This is the {{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:

{{current other |result if in current version |result if in old version}}</pre>

If the template is on a current page, it will return this:

result if in current version

If the template is on any other page, it will return this:

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:

{{current other |{{current}}}}

Or to only show text in an old version of an article:

{{current other | |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:

{{current other |result if in current version|result if in old version|demospace=current}}

No matter on what version of a page the code above is used, it will return: result if in current version

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:

{{current other |result if in current version|result if in old version|demospace={{{demospace|}}} }}

Technical details

This template compares {{REVISIONID}} to {{REVISIONID:{{FULLPAGENAME}}}} to determine whether it's being shown in the current version.