Help:Variables

From Nottinghack Wiki
Revision as of 13:28, 6 February 2019 by Jon (talk | contribs) (Category:Help)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Variables

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}} 16759 Unique revision ID
{{REVISIONDAY}} 6 Day the edit was made (unpadded number)
{{REVISIONMONTH}} 02 Month the edit was made
{{REVISIONYEAR}} 2019 Year the edit was made
{{REVISIONTIMESTAMP}} 20190206132828 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