Help:Variables
From STIQ
| Important note: When you edit this page, you agree to release your contribution into the public domain. If you don't want this or can't do this because of license restrictions, please don't edit. This page is one of the Public Domain Help Pages, which can be freely copied into fresh wiki installations and/or distributed with MediaWiki software; see Help:Contents for an overview of all pages. |
MediaWiki variables are strings of text that output as information such as time, site details, or page names.
Contents |
Parsing
The syntax of most variables is similar to templates, but capitalized to help avoid conflicts. If a template has the same name and case as a variable, the variable will be used. Usage of the template can be forced by adding the "msg:" modifier (for example, "{{msg:CURRENTYEAR}}").
Page-dependent variables will return data about the currently-viewed page, regardless of whether the variable is in the page code or a transcluded template.
Variables
Date & time
The following variables return the current date and time according to the user's timezone preferences, defaulting to the UTC timezone.
Due to MediaWiki and browser caching, these variables frequently show when the page was cached rather than the current time.
| Variable | Output | Description |
|---|---|---|
| Year | ||
| {{CURRENTYEAR}} | 2012 | Year |
| Month | ||
| {{CURRENTMONTH}} | 05 | Month (zero-padded number) |
| {{CURRENTMONTHNAME}} | May | Month (name) |
| {{CURRENTMONTHNAMEGEN}} | May | Month (genitive form) |
| {{CURRENTMONTHABBREV}} | May | Month (abbreviation) |
| Day | ||
| {{CURRENTDAY}} | 17 | Day of the month (unpadded number) |
| {{CURRENTDAY2}} | 17 | Day of the month (zero-padded number) |
| {{CURRENTDOW}} | 4 | Day of the week (unpadded number) |
| {{CURRENTDAYNAME}} | Thursday | Day of the week (name) |
| Time | ||
| {{CURRENTTIME}} | 12:22 | Time (24-hour HH:mm format) |
| {{CURRENTHOUR}} | 12 | Hour (24-hour zero-padded number) |
| Other | ||
| {{CURRENTWEEK}} | 20 | Week (number) |
| {{CURRENTTIMESTAMP}} | 20120517122253 | ISO 8601 time stamp |
The following variables do the same as the above, but using the site's local timezone instead of user preferences and UTC:
- {{LOCALYEAR}}
- {{LOCALMONTH}}
- {{LOCALMONTHNAME}}
- {{LOCALMONTHABBREV}}
- {{LOCALDAY}}
- {{LOCALDAY2}}
- {{LOCALDOW}}
- {{LOCALDAYNAME}}
- {{LOCALTIME}}
- {{LOCALHOUR}}
- {{LOCALWEEK}}
- {{LOCALTIMESTAMP}}
Statistics and technical details
Site
| Variable | Output | Description |
|---|---|---|
| {{SITENAME}} | STIQ | Name of the wiki ($wgSitename) |
| {{CONTENTLANGUAGE}} | en | Default interface language ($wgLanguageCode) |
| {{NUMBEROFPAGES}} | 684 | Number of wiki pages |
| {{NUMBEROFARTICLES}} | 191 | Number of pages in main namespace |
| {{NUMBEROFFILES}} | 61 | Number of uploaded files |
Latest revision to a page
The following variables return data about the latest edit to the current page, even if viewing an older version of the page.
| Variable | Output | Description |
|---|---|---|
| {{REVISIONID}} | 3624 | Unique ID |
| {{REVISIONDAY}} | 30 | Day edit was made (unpadded number) |
| {{REVISIONDAY2}} | 30 | Day edit was made (zero-padded number) |
| {{REVISIONMONTH}} | 11 | Month edit was made (unpadded number) |
| {{REVISIONYEAR}} | 2007 | Year edit was made |
| {{REVISIONTIMESTAMP}} | 20071130182818 | Timestamp as of time of edit |
URL data
URLs
| Variable | Output | Description |
|---|---|---|
| {{SERVER}} | http://storytestiq.solutionsiq.com | domain URL ($wgServer) |
| {{SERVERNAME}} | storytestiq.solutionsiq.com | domain name ($wgServerName) |
| {{SCRIPTPATH}} | /w | relative script path ($wgScriptPath) |
| {{localurl:pagename}} {{localurl:pagename|query string}} | /wiki/Pagename /w/index.php?title=Pagename&query string | relative path to title |
Page names
| Variable | Output | Description |
|---|---|---|
| {{FULLPAGENAME}} | Help:Variables | Namespace and page title |
| {{BASEPAGENAME}} | Variables | The namespace and page title excluding the current subpage ("Title" on "Title/foo") |
| {{PAGENAME}} | Variables | Page title |
| {{SUBPAGENAME}} | Variables | The subpage title ("foo" on "Title/foo") |
| {{SUBJECTPAGENAME}} | Help:Variables | The title of the associated content page. |
| {{TALKPAGENAME}} | Help talk:Variables | The title of the associated talk page. |
The following are URL-encoded equivalents:
- {{FULLPAGENAMEE}}
- {{PAGENAMEE}}
- {{BASEPAGENAMEE}}
- {{SUBPAGENAMEE}}
- {{SUBJECTPAGENAMEE}}
- {{TALKPAGENAMEE}}
Namespaces
| Variable | Output | Description |
|---|---|---|
| {{NAMESPACE}} | Help | Namespace (name) |
| {{SUBJECTSPACE}} | Help | Name of the associated content namespace |
| {{TALKSPACE}} | Help talk | Name of the associated talk namespace |
The following are URL-encoded equivalents:
- {{NAMESPACEE}}
- {{SUBJECTSPACEE}}
- {{TALKSPACEE}}
{{ns:}} returns the localized namespace name for that number of constant. The default values are:
| Usage | Output |
|---|---|
| {{ns:-2}} or {{ns:Media}} | Media |
| {{ns:-1}} or {{ns:Special}} | Special |
| {{ns:0}} or {{ns:Main}} | |
| {{ns:1}} or {{ns:Talk}} | Talk |
| {{ns:2}} or {{ns:User}} | User |
| {{ns:3}} or {{ns:User_talk}} | User_talk |
| {{ns:4}} or {{ns:Project}} | STIQ |
| {{ns:5}} or {{ns:Project_talk}} | STIQ_talk |
| {{ns:6}} or {{ns:Image}} | Image |
| {{ns:7}} or {{ns:Image_talk}} | Image_talk |
| {{ns:8}} or {{ns:MediaWiki}} | MediaWiki |
| {{ns:9}} or {{ns:MediaWiki_talk}} | MediaWiki_talk |
| {{ns:10}} or {{ns:Template}} | Template |
| {{ns:11}} or {{ns:Template_talk}} | Template_talk |
| {{ns:12}} or {{ns:Help}} | Help |
| {{ns:13}} or {{ns:Help_talk}} | Help_talk |
| {{ns:14}} or {{ns:Category}} | Category |
| {{ns:15}} or {{ns:Category_talk}} | Category_talk |
Custom variables
MediaWiki also supports custom variables defined as part of extensions or specific to a particular installation. For example, some installations might find it helpful to have a variable that identifies the name of the sponsoring organization or the portion of the wiki URL that precedes the title if it is liable to change or more complex than http://{{SERVERNAME}}.
For more information, please see Manual:Variables.
External links
| MetaWiki: Help:Variable |
>== Template ==
<onlyinclude><div class="LanguageLinks">
<table width="100%">
<tr valign="top" style="background: #EEF3E2">
<td style="width: 25px; padding-left: 0.5em;">
</td>
<td style="width: 10px; white-space: nowrap; padding: 4px 1em 0 0.5em; border-right: 1px solid #aaaaaa;">Languages: </td><td style="padding: 1px 1em 0; background: #F6F9ED;">
English
{{#ifexist: {{#if: Help:Variables | Help:Variables | {{#if: Help | Help:}}Variables}}/ar | • {{#if: Help:Variables|العربية| العربية}}|}}
{{#ifexist: {{#if: Help:Variables | Help:Variables | {{#if: Help | Help:}}Variables}}/br | • {{#if: Help:Variables|Brezhoneg| Brezhoneg}}|}}
{{#ifexist: {{#if: Help:Variables | Help:Variables | {{#if: Help | Help:}}Variables}}/ca | • {{#if: Help:Variables|Català| Català}}|}}
{{#ifexist: {{#if: Help:Variables | Help:Variables | {{#if: Help | Help:}}Variables}}/cs | • {{#if: Help:Variables|Česky| Česky}}|}}
{{#ifexist: {{#if: Help:Variables | Help:Variables | {{#if: Help | Help:}}Variables}}/de | • {{#if: Help:Variables|Deutsch| Deutsch}}|}}
{{#ifexist: {{#if: Help:Variables | Help:Variables | {{#if: Help | Help:}}Variables}}/el | • {{#if: Help:Variables|Ελληνικά| Ελληνικά}}|}}
{{#ifexist: {{#if: Help:Variables | Help:Variables | {{#if: Help | Help:}}Variables}}/es | • {{#if: Help:Variables|Español| Español}}|}}
{{#ifexist: {{#if: Help:Variables | Help:Variables | {{#if: Help | Help:}}Variables}}/fa | • {{#if: Help:Variables|فارسی| فارسی}}|}}
{{#ifexist: {{#if: Help:Variables | Help:Variables | {{#if: Help | Help:}}Variables}}/fi | • {{#if: Help:Variables|Suomi| Suomi}}|}}
{{#ifexist: {{#if: Help:Variables | Help:Variables | {{#if: Help | Help:}}Variables}}/fr | • {{#if: Help:Variables|Français| Français}}|}}
{{#ifexist: {{#if: Help:Variables | Help:Variables | {{#if: Help | Help:}}Variables}}/he | • {{#if: Help:Variables|עברית| עברית}}|}}
{{#ifexist: {{#if: Help:Variables | Help:Variables | {{#if: Help | Help:}}Variables}}/hu | • {{#if: Help:Variables|Magyar| Magyar}}|}}
{{#ifexist: {{#if: Help:Variables | Help:Variables | {{#if: Help | Help:}}Variables}}/id | • {{#if: Help:Variables|Bahasa Indonesia| Bahasa Indonesia}}|}}
{{#ifexist: {{#if: Help:Variables | Help:Variables | {{#if: Help | Help:}}Variables}}/it | • {{#if: Help:Variables|Italiano| Italiano}}|}}
{{#ifexist: {{#if: Help:Variables | Help:Variables | {{#if: Help | Help:}}Variables}}/ja | • {{#if: Help:Variables|日本語| 日本語}}|}}
{{#ifexist: {{#if: Help:Variables | Help:Variables | {{#if: Help | Help:}}Variables}}/ko | • {{#if: Help:Variables|한국어| 한국어}}|}}
{{#ifexist: {{#if: Help:Variables | Help:Variables | {{#if: Help | Help:}}Variables}}/mr | • {{#if: Help:Variables|मराठी| मराठी}}|}}
{{#ifexist: {{#if: Help:Variables | Help:Variables | {{#if: Help | Help:}}Variables}}/nl | • {{#if: Help:Variables|Nederlands| Nederlands}}|}}
{{#ifexist: {{#if: Help:Variables | Help:Variables | {{#if: Help | Help:}}Variables}}/no | • {{#if: Help:Variables|Norsk (bokmål)| Norsk (bokmål)}}|}}
{{#ifexist: {{#if: Help:Variables | Help:Variables | {{#if: Help | Help:}}Variables}}/oc | • {{#if: Help:Variables|Occitan| Occitan}}|}}
{{#ifexist: {{#if: Help:Variables | Help:Variables | {{#if: Help | Help:}}Variables}}/pl | • {{#if: Help:Variables|Polski| Polski}}|}}
{{#ifexist: {{#if: Help:Variables | Help:Variables | {{#if: Help | Help:}}Variables}}/pt | • {{#if: Help:Variables|Português| Português}}|}}
{{#ifexist: {{#if: Help:Variables | Help:Variables | {{#if: Help | Help:}}Variables}}/ro | • {{#if: Help:Variables|Română| Română}}|}}
{{#ifexist: {{#if: Help:Variables | Help:Variables | {{#if: Help | Help:}}Variables}}/ru | • {{#if: Help:Variables|Русский| Русский}}|}}
{{#ifexist: {{#if: Help:Variables | Help:Variables | {{#if: Help | Help:}}Variables}}/sq | • {{#if: Help:Variables|Shqip| Shqip}}|}}
{{#ifexist: {{#if: Help:Variables | Help:Variables | {{#if: Help | Help:}}Variables}}/sr | • {{#if: Help:Variables|Српски / Srpski| Српски / Srpski}}|}}
{{#ifexist: {{#if: Help:Variables | Help:Variables | {{#if: Help | Help:}}Variables}}/sv | • {{#if: Help:Variables|Svenska| Svenska}}|}}
{{#ifexist: {{#if: Help:Variables | Help:Variables | {{#if: Help | Help:}}Variables}}/th | • {{#if: Help:Variables|ไทย| ไทย}}|}}
{{#ifexist: {{#if: Help:Variables | Help:Variables | {{#if: Help | Help:}}Variables}}/vi | • {{#if: Help:Variables|Tiếng Việt| Tiếng Việt}}|}}
{{#ifexist: {{#if: Help:Variables | Help:Variables | {{#if: Help | Help:}}Variables}}/yue | • {{#if: Help:Variables|粵語| 粵語}}|}}
{{#ifexist: {{#if: Help:Variables | Help:Variables | {{#if: Help | Help:}}Variables}}/zh | • {{#if: Help:Variables|中文| 中文}}|}}
{{#ifexist: {{#if: Help:Variables | Help:Variables | {{#if: Help | Help:}}Variables}}/zh-hans | • {{#if: Help:Variables|中文(简体)| 中文(简体)}}|}}
{{#ifexist: {{#if: Help:Variables | Help:Variables | {{#if: Help | Help:}}Variables}}/zh-hant | • {{#if: Help:Variables|中文(繁體)| 中文(繁體)}}|}}
</td></tr></table></div></onlyinclude>
Syntax
{{{Languages|PageName}}}
- PageName (optional) - the name of the page to display language links for. If omitted then the English version of the current page is used. This parameter can normally be omitted, as it is only required if you want to link to a page other than the one you place the template on, which is very uncommon. If this parameter is used on a sub-page make sure you supply the root name, not the full page name (e.g. on MediaWiki/fr you would need to use
{{{Languages|MediaWiki}}}and not{{{Languages|MediaWiki/fr}}}).
Usage
The template should only be placed on pages that exist in more than one language, and it should be placed in the same location on each translation of the page.
The English version of a page is always the main version, with all other languages as sub-pages, named using the appropriate language code (see below).
For example, on the Main Page you would include the text {{{Languages}}}, both on Main Page itself, and on each of its language sub-pages. The template automatically creates links to any language sub-pages that exist, e.g. Main Page/ja<tt>, <tt>Main Page/fr, and ignores non-existant languages.
See Project:Language policy for further details about translating pages.
Supported languages
This shows you the name of each language's sub-page (using Main Page as an example). Other languages may be added easily as necessary. Please use the appropriate prefix, as used on Wikipedia when adding a new language. Please do not add languages for which no pages exist yet, as this will increase the time needed to include the template without adding any benefit (languages are only displayed to the user when the relevant page exists).
The link on the language names goes to the Wikipedia in that language. If no Wikipedia in your language exists, do not add pages in that language to MediaWiki.org! This wiki is not the place for language advocacy - please go through the correct channels, and once your language has a Wikipedia then please return to add content here.
| Page Name | Language |
|---|---|
| Main Page | English |
| Main Page/ar | Arabic |
| Main Page/br | Breton |
| Main Page/ca | Catalan |
| Main Page/cs | Czech |
| Main Page/de | German |
| Main Page/el | Greek |
| Main Page/es | Spanish |
| Main Page/fa | Persian |
| Main Page/fi | Finnish |
| Main Page/fr | French |
| Main Page/he | Hebrew |
| Main Page/hu | Hungarian |
| Main Page/id | Indonesian |
| Main Page/it | Italian |
| Main Page/ja | Japanese |
| Main Page/ko | Korean |
| Main Page/mr | Marathi |
| Main Page/nl | Nederlands |
| Main Page/no | Norwegian |
| Main Page/oc | Occitan |
| Main Page/pl | Polish |
| Main Page/pt | Portugese |
| Main Page/ro | Romanian |
| Main Page/ru | Russian |
| Main Page/sq | Albanian |
| Main Page/sr | Serbian |
| Main Page/sv | Swedish |
| Main Page/th | Thai |
| Main Page/vi | Vietnamese |
| Main Page/yue | Cantonese |
| Main Page/zh | Chinese |
| Main Page/zh-hans | Chinese (Simplified) |
| Main Page/zh-hant | Chinese (Traditional) |
Example
Here is how the language bar looks on the MediaWiki page: Languages
