Help:Variables: Difference between revisions
{{also|Help:Contents}} |
|||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{also|Help:Contents|Help:Reference guide#Magic Words}} | |||
Variables return information about the current page, wiki, or date. Their syntax is similar to templates. | Variables return information about the current page, wiki, or date. Their syntax is similar to templates. | ||
== Technical metadata == | |||
Revision variables return data about the latest edit to the current page, even if viewing an older version of the page. | Revision variables return data about the latest edit to the current page, even if viewing an older version of the page. | ||
{| class="wikitable" | {| class="wikitable" | ||
Line 77: | Line 77: | ||
|} | |} | ||
== Statistics == | |||
Numbers returned by these variables normally contain separators (commas or spaces, depending on the local language), but can return raw numbers with the ":R" flag (for example, <code><nowiki>{{NUMBEROFPAGES}}</nowiki></code> → {{NUMBEROFPAGES}} and <code><nowiki>{{NUMBEROFPAGES:R}}</nowiki></code> → {{NUMBEROFPAGES:R}}). Use "|R" for magic words that require a parameter like PAGESINCATEGORY (for example <code><nowiki>{{PAGESINCATEGORY:Help}}</nowiki></code> and <code><nowiki>{{PAGESINCATEGORY:Help|R}}</nowiki></code>). Also applicable to <code><nowiki>{{PAGESIZE:</nowiki>''page name''<nowiki>}}</nowiki></code> above. | Numbers returned by these variables normally contain separators (commas or spaces, depending on the local language), but can return raw numbers with the ":R" flag (for example, <code><nowiki>{{NUMBEROFPAGES}}</nowiki></code> → {{NUMBEROFPAGES}} and <code><nowiki>{{NUMBEROFPAGES:R}}</nowiki></code> → {{NUMBEROFPAGES:R}}). Use "|R" for magic words that require a parameter like PAGESINCATEGORY (for example <code><nowiki>{{PAGESINCATEGORY:Help}}</nowiki></code> and <code><nowiki>{{PAGESINCATEGORY:Help|R}}</nowiki></code>). Also applicable to <code><nowiki>{{PAGESIZE:</nowiki>''page name''<nowiki>}}</nowiki></code> above. | ||
{| class="wikitable" | {| class="wikitable" | ||
Line 124: | Line 124: | ||
|} | |} | ||
== Page name variables == | |||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
Line 167: | Line 167: | ||
* <code><nowiki>{{PAGENAME:Template:Main Page}}</nowiki></code> → '''{{PAGENAME:Template:Main Page}}''' | * <code><nowiki>{{PAGENAME:Template:Main Page}}</nowiki></code> → '''{{PAGENAME:Template:Main Page}}''' | ||
== Namespace variables == | |||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- |
Latest revision as of 16:03, 28 March 2019
- See also: Help:Contents and Help:Reference guide#Magic Words
Variables return information about the current page, wiki, or date. Their syntax is similar to templates.
Technical metadata
Revision variables return data about the latest edit to the current page, even if viewing an older version of the page.
Variable | Output | Description |
---|---|---|
Site | ||
{{SITENAME}}
|
Nottinghack Wiki | The wiki's site name. |
{{SERVER}}
|
https://wiki.nottinghack.org.uk | Domain URL. |
{{SERVERNAME}}
|
wiki.nottinghack.org.uk | Domain name. |
{{SCRIPTPATH}}
|
Relative path to the wiki scripts on the server. | |
{{STYLEPATH}}
|
/skins | Relative path to the wiki style sheet on the server. |
{{CURRENTVERSION}}
|
1.42.1 | The wiki's MediaWiki version. |
Latest revision to current page | ||
{{REVISIONID}}
|
20621 | Unique revision ID |
{{REVISIONDAY}}
|
28 | Day the edit was made (unpadded number) |
{{REVISIONMONTH}}
|
03 | Month the edit was made |
{{REVISIONYEAR}}
|
2019 | Year the edit was made |
{{REVISIONTIMESTAMP}}
|
20190328160317 | Timestamp of the edit |
{{REVISIONUSER}}
|
Jon | The user who made the most recent edit to the page, or the current user when previewing an edit |
{{PROTECTIONLEVEL:action}}
|
protection level | The protection level (e.g. 'autoconfirm', 'sysop') for a given action (e.g. 'edit', 'move') on the current page or an empty string if not protected. |
Affects page content | ||
{{DISPLAYTITLE:title}}
|
Format the current page's title. The value must be equivalent to the default title: only capitalization changes and replacing spaces with underscores are allowed. | |
{{DEFAULTSORT:sortkey}} {{DEFAULTSORTKEY:sortkey}} {{DEFAULTCATEGORYSORT:sortkey}}
|
Used for categorizing pages, sets a default category sort key. For example if you put {{DEFAULTSORT:Smith, John}} at the end of John Smith, the page would be sorted under "S" by default in categories.
|
Statistics
Numbers returned by these variables normally contain separators (commas or spaces, depending on the local language), but can return raw numbers with the ":R" flag (for example, {{NUMBEROFPAGES}}
→ 5,467 and {{NUMBEROFPAGES:R}}
→ 5467). Use "|R" for magic words that require a parameter like PAGESINCATEGORY (for example {{PAGESINCATEGORY:Help}}
and {{PAGESINCATEGORY:Help|R}}
). Also applicable to {{PAGESIZE:page name}}
above.
Variable | Output | Description |
---|---|---|
Entire wiki | ||
{{NUMBEROFPAGES}}
|
5,467 | Number of wiki pages. |
{{NUMBEROFARTICLES}}
|
973 | Number of pages in content namespaces. |
{{NUMBEROFFILES}}
|
2,653 | Number of uploaded files. |
{{NUMBEROFEDITS}}
|
28,876 | Number of page edits. |
{{NUMBEROFVIEWS}}
|
Template:NUMBEROFVIEWS | Number of page views. Usually useless on a wiki using caching. |
{{NUMBEROFUSERS}}
|
354 | Number of registered users. |
{{NUMBEROFADMINS}}
|
19 | Number of users in the sysop admin group. |
{{NUMBEROFACTIVEUSERS}}
|
21 | Number of active users, based on the criteria used in Special:Statistics. |
{{NUMBERINGROUP:groupname}} {{NUMINGROUP:groupname}}
|
Number of users in a specific group. |
Page name variables
Variable | Output | Description |
---|---|---|
{{FULLPAGENAME}}
|
Help:Variables | Namespace and page title. |
{{PAGENAME}}
|
Variables | Page title. |
{{BASEPAGENAME}}
|
Variables | Page title excluding the current subpage and namespace. For more complex splitting, use {{#titleparts:}} .
|
{{SUBPAGENAME}}
|
Variables | The subpage title. |
{{SUBJECTPAGENAME}}
|
Help:Variables | The namespace and title of the associated content page. |
{{TALKPAGENAME}}
|
Help talk:Variables | The namespace and title of the associated talk page. |
The following are equivalents encoded for use in MediaWiki URLs (i.e. spaces replaced with underscores and some characters percent-encoded):
{{FULLPAGENAMEE}}
{{PAGENAMEE}}
{{BASEPAGENAMEE}}
{{SUBPAGENAMEE}}
{{SUBJECTPAGENAMEE}}
{{TALKPAGENAMEE}}
These can all take a parameter allowing specification of the page to be operated on, instead of just the current page:
{{PAGENAME:Template:Main Page}}
→ Main Page
Namespace variables
Variable | Output | Description |
---|---|---|
{{NAMESPACE}}
|
Help | Name of the page's namespace |
{{SUBJECTSPACE}} {{ARTICLESPACE}}
|
Help Help |
Name of the associated content namespace |
{{TALKSPACE}}
|
Help talk | Name of the associated talk namespace |
The following are equivalents encoded for use in MediaWiki URLs (spaces replaced with underscores and some characters percent-encoded):
{{NAMESPACEE}}
{{SUBJECTSPACEE}}
{{TALKSPACEE}}
These can take a page name instead of operating on the current page:
{{NAMESPACE:Template:Main Page}}
→ Template{{SUBJECTSPACE:Template:Main Page}}
→ Template{{TALKSPACE:Template:Main Page}}
→ Template talk