Strict Standards: Non-static method ExprParser::addMessages() should not be called statically, assuming $this from incompatible context in /home/world/public_html/learn/extensions/ParserFunctions/ParserFunctions.php on line 32


Learn more about Help:Variable

Jump to: navigation, search

This is a copy of the master help page at Meta. Do not edit this copy.
Edits will be lost in the next update from the master page. See below for more information.

Start new pages
Page name

Piped links
Interwiki linking
Footnotes (References)

Lists & Tables
Image & file uploads

Redirects (forward)
Moving a page
Page size

Fixing mistakes
Reverting edits
Show preview

Saving effort
Editing shortcuts
Edit toolbar
Magic words

Edit summary
Talk page
Edit conflict
Minor edit



A variable can be considered a predefined template.

This is a list of variables that can be used in the wikitext. The way they are rendered vary with time (directly depending on time, or e.g. for number of articles, depending on the creation of other articles), on the project (it changes when the wikitext is copied), or on the page in which it occurs (it changes when the wikitext is copied, when the page is renamed, and when the page is included in another page).

On the left is the variable, on the right how it is rendered at this time, in this project, on this page.

The names of the variables form part of the set of so-called "magic words" the system uses.


Constants depending on parameters

Most of the following "constants" are in fact parser functions also known as predefined templates, and might change, e.g. if the {{SERVERNAME}} is changed. They are listed here for historical reasons:

{{ns:-2}} {{ns:Media}} Media Media
{{ns:-1}} {{ns:Special}} Special Special
{{ns:0}}   ( main namespace ) ( empty string )
{{ns:1}}  {{ns:Talk}} Talk Talk
{{ns:2}}  {{ns:User}} User User
{{ns:3}}  {{ns:User_talk}} User_talk User_talk
{{ns:4}}  {{ns:Project}} World_Wizzy World_Wizzy
{{ns:5}}  {{ns:Project_talk}} World_Wizzy_talk World_Wizzy_talk
{{ns:6}}  {{ns:Image}} Image Image
{{ns:7}}  {{ns:Image_talk}} Image_talk Image_talk
{{ns:8}}  {{ns:MediaWiki}} MediaWiki MediaWiki
{{ns:9}} {{ns:MediaWiki_talk}} MediaWiki_talk MediaWiki_talk
{{ns:10}} {{ns:Template}} Template Template
{{ns:11}} {{ns:Template_talk}} Template_talk Template_talk
{{ns:12}} {{ns:Help}} Help Help
{{ns:13}} {{ns:Help_talk}} Help_talk Help_talk
{{ns:14}} {{ns:Category}} Category Category
{{ns:15}} {{ns:Category_talk}} Category_talk Category_talk
{{ns:100}} {{ns:102}}, etc. (customized )
{{ns:101}} {{ns:103}}, etc.
{{SITENAME}} World Wizzy
{{localurl:fullpagename}} /library/Fullpagename
{{localurl:page|query=x}} /learn/index.php?title=Page&query=x
{{urlencode:a&b!}} a%26b%21

The parser function localurl:<tt> replaces spaces by underscores and special characters by escape codes, e.g. {{localurl:a !}} gives /library/A_%21. The main purpose was to create a link to a given page in external link style in the same project or a project which uses the same string in the URL between the server name and the page name. This function is now better served by less verbose <tt>fullurl: constructs, {{fullurl:page}} is a shorthand for {{SERVER}}{{localurl:page}}.

Both fullurle: and localurle: performed additional character escaping on the resulting link, but no example is known where that still has any additional effect.

Note that fullurl: and localurl: don't encode special characters and spaces in the optional query-string parameter. At least for spaces this will result in broken URLs:
{{fullurl:m:Special:Contributions|target=Jimbo Wales&limit=10}} Wales&limit=10

With target={{urlencode:Jimbo Wales}}&limit=10 as query-string it works:

The new urlencode: encodes spaces as "+", not "_" or the generally supported "%20", this might have interesting effects, take care. Trailing spaces are stripped, leading spaces respected: {{urlencode:  @ !  }} yields %40+%21.

For obvious reasons encoding "}}" or "|" cannot work directly. Don't encode "=", "&", or ";" in structured query-strings unless you really want it.


Say you want to create a link in a template to the block log for blocked usernames -> "{{fullurl:Special:Log/block|user=User:{{{1}}} }}". This won't work with spaces in the name like "Willy on Wheels" (unless they are manually underlined) as you'd get: " on Wheels", so what you can do is escape it with: "{{fullurl:Special:Log/block|user=User:{{urlencode:{{{1}}}}} }}", giving you ""

Also, the magic words for page name like {{PAGENAME}} {{FULLPAGENAME}} etc all have 'escaped' versions: {{PAGENAMEE}} {{FULLPAGENAMEE}} etc.

Depending on page

{{PAGENAME}} Variable{{PAGENAMEE}} Variable
{{FULLPAGENAME}} Help:Variable{{FULLPAGENAMEE}} Help:Variable
   {{REVISIONID}} 91254813
{{TALKPAGENAME}}Help talk:Variable{{SUBJECTPAGENAME}} Help:Variable
{{TALKPAGENAMEE}}Help_talk:Variable{{SUBJECTPAGENAMEE}} Help:Variable

For the rendering on page A, these variables depend on page A, even if page A contains the variable due to inclusion of page B. Variables in the sort key of a category tag refer to the page with the tag, not the category page where it takes effect.

{{NAMESPACE}} and {{NAMESPACEE}} return an empty string in the article namespace {{ns:0}}, see above and NS:0.

PAGENAMEE displays the page title in the form that is used in URLs, i.e. with underscores for spaces, and percent-encoding for special characters, and is therefore used for constructing URLs incl. query strings.

For example, on Template talk:!, SUBJECTPAGENAMEE would produce Template:%21. Don't encode PAGENAMEE etc. again, i.e. don't use it in the first parameter of fullurl: and similar parser functions, {{urlencode:%21}} = %2521 probably won't work as expected. Query strings  in PURL redirections are an exception.

The "EE" encoding examples shown above for this page are not very interesting, only TALKPAGENAMEE and TALKSPACEE differ from TALKPAGENAME and TALKSPACE. See Help:Link and Help:Magic words for other examples.

In a subpage, [[../]] renders as a link to the parent page. For example, on m:Link/a/b it gives an internal link to m:Link/a, see Help:Link#Subpage feature.

{{ REVISIONID}} = 91254813 showing the current unique revision number of a saved page as used for diffs in the page history is in essence useless, it can't be substituted and also doesn't work in preview.

Varying with time

{{CURRENTTIMESTAMP}} 20161122104522

Time variables which change more often than once a day are generally useful only as curiosities. Because of the way article HTML is cached, these variables may be wrong by up to 24 hours, and so are not a reliable way to tell the user the current time.

Please note that a template using more than one CURRENT variable directly or indirectly is suspicious. There can be critical races near hh:mm:59. The following code to determine the minute can produce spurious results if the timestamp changes during the evaluation: {{#expr:(( {{CURRENTTIMESTAMP}}-{{CURRENTTIMESTAMP}} mod 100)/100) mod 100}} = 45
This is actually an intermittent bug with MOD depending on the size (not the value) of CURRENTTIMESTAMP, see m:Template:CURRENTMINUTE (talk, backlinks, edit).

0=Sunday, 1=Monday, .. 6=Saturday.
is the number of the current week (1-53) according to ISO 8601 with no leading zero.
adds a leading zero to days 1...9, this allows to construct the ISO date formats like 2016-11-22T10:45Z.
is the genitive grammatical form of the month name (used in Finnish (unclear) and in Slovenian).
see Help:Article count and Special:Statistics..


Main article: Help:Substitution

When {{<includeonly>subst:</includeonly>CURRENTTIMESTAMP}} is included and thereby substituted, the timestamp of doing that is put in the wikitext, and similarly for other variables. Examples:

20161122104522 - stays a variable on pages including the template
20060526024210 - became a substituted constant in the template
20161122104522 - becomes a constant at the time of its inclusion

Templates with the "includeonly subst magic" must also be subst-ed.

New NUMBEROF syntax

The "old" (for some weeks) syntax was {{ NUMBEROFitem|R }} to get the "raw" number without fancy comma separators. The new syntax is {{ NUMBEROFitem:R }} with a colon to get the "raw" number of whatever. This also affects the new magic words PAGESINNS and PAGESINNAMESPACE, now disabled by default.

Using the old format will (try to) include a corresponding template. Because the "old" feature is in fact rather new it might be possible to fix the syntax using What links here:
PAGESINNS 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 100, 101, 102, 103, etc.

Examples of combinations

[[{{NAMESPACE}} talk:{{PAGENAME}}]]
Help talk:Variable
{{fullurl:{{NAMESPACE}} talk:{{PAGENAME}}}}

The old form {{SERVER}}{{localurl:page }} is in essence the same as {{fullurl:page }} in recent (1.5+) versions of the software.

In a template, for a link to a page which depends on a template parameter, the external link style is used even for internal links, to avoid that the system links to the edit page even if the page exists. To construct the external link, variables can also be useful.

Variable in the form of a template call

If the syntax of a template call with parameters is applied with the name of a variable, depending on the variable the parameters are either ignored or cause the variable to be interpreted as a (non-existing) template:

  1. Variables like {{NUMBEROFPAGES:R}} = with a "raw" format are always handled as variable, {{NUMBEROFPAGES:R|Para|meter}} = .
  2. Other variables like {{CURRENTDAYNAME}} = Tuesday are handled as template for given parameter(s), {{CURRENTDAYNAME|x}} = Template:CURRENTDAYNAME.
  3. Parser functions like {{lc: Lower Case}} = lower case ignore extraneous parameters, {{lc: Lower|Case}} = lower.
  4. Parser function ns (e.g. {{ns: 1}} = Talk) gives an empty string for a non-applicable numerical parameter value, and evaluates a non-numerical parameter value as template, even if it has the name of a variable:
    {{ns: 1234}} =
    {{ns: t|abc}} = Template:Ns: t
  5. Parser functions like fullurl don't support the ../ notation, and in namespaces supporting subpages this has odd effects: like above, they evaluate such an invalid parameter value as template, see Link/a and Link/a/b. Here it just renders the wikitext:
    {{fullurl:../a}} = Template:Fullurl:../a.
    The cases #2, #4, and #5 resulting in template calls are probably related.

See also


Wikipedia-specific help

As shown above Wikipedia has only two customized namespaces:


They can be also used by their name:

{{ns:{{ns:100}}}} Template:Ns:
{{ns:{{ns:101}}}} Template:Ns:


This page is a copy of the master help page at Meta (for general help information all Wikimedia projects can use), with two Wikipedia-specific templates inserted. To update the main text, edit the master help page for all projects at m:Help:Variable. For Wikipedia-specific issues, use Template:Ph:Variable (the extra text at the bottom of this page) or Template:Phh:Variable for a Wikipedia-specific lead (text appears at the top of this page). You are welcome to copy the exact wikitext from the master page at Meta and paste it into this page at any time. To view this page in other languages see the master page at Meta.

id:Bantuan:Variabel su:Pitulung:Variabel tr:Vikipedi:Değişkenler


Personal tools
what is world wizzy?
  • World Wizzy is a static snapshot taken of Wikipedia in early 2007. It cannot be edited and is online for historic & educational purposes only.