Help:Variable

From wiki.thepatternofeverything.org
Jump to: navigation, search

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 colon 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 ) {{ns:0}} ( 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}} wiki.thepatternofeverything.org wiki.thepatternofeverything.org
{{ns:5}}  {{ns:Project_talk}} wiki.thepatternofeverything.org talk wiki.thepatternofeverything.org talk
{{ns:6}}  {{ns:Image}} File File
{{ns:7}}  {{ns:Image_talk}} File talk File 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}} wiki.thepatternofeverything.org
{{SERVER}} https://wiki.thepatternofeverything.org
{{SERVERNAME}} wiki.thepatternofeverything.org
{{localurl:fullpagename}} /index.php?title=Fullpagename
{{localurl:page|query=x}} /index.php?title=Page&query=x
{{localurl:a&b!}}
{{localurle:a&b!}}
/index.php?title=A%26b!
/index.php?title=A%26b!

Depending on page

{{PAGENAME}}
{{NAMESPACE}}
{{REVISIONID}}


Variables

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

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


Page Name

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.


Links and Magic Words

See Help:Link and Help:Magic words for other examples.


Subpages

In a subpage, [[../]] renders as a link to the parent page. See Help:Link#Subpage feature.

Varying with time

{{CURRENTYEAR}} 2024   {{CURRENTMONTH}} 04
{{CURRENTMONTHNAME}} April   {{CURRENTMONTHABBREV}} Apr
{{CURRENTMONTHNAMEGEN}} April   {{CURRENTWEEK}} 16
{{CURRENTDAY}} 16   {{CURRENTDAY2}} 16
{{CURRENTDAYNAME}} Tuesday   {{CURRENTDOW}} 2
{{CURRENTTIME}} 17:34  
{{NUMBEROFARTICLES}} 1,582  
{{NUMBEROFFILES}} 100  

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.


CURRENTDOW 
0=Sunday, 1=Monday, .. 6=Saturday.
CURRENTWEEK 
is the number of the current week (1-53) according to ISO 8601 with no leading zero.
CURRENTDAY2 
adds a leading zero to days 1...9, this allows to construct the ISO date formats like 2024-04-16T17:34Z.
CURRENTMONTHNAMEGEN 
is the genitive grammatical form of the month name
NUMBEROFARTICLES 
see Help:Article count and Special:Statistics..


Substitution

Main article: Help:Substitution


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:
NUMBEROF ADMINS, ARTICLES, FILES, PAGES, USERS.
PAGESINNS 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 100, 101, 102, 103, etc.



See also