From WikiTemp, the GBAtemp wiki
m (Protected "Help:Variables" [edit=sysop:move=sysop])
(Major Cleanup)
Line 1: Line 1:
MediaWiki knows some defined variables which can be used in texts. They are rendered differently depending on the time, the site and the page. Their syntax is similar to templates. If you want a page to show always the current time, you use <code><nowiki>{{CURRENTTIME}}</nowiki></code>. To distinguish variables from templates, most variables are capitalized.
+
Magic words are strings of text that MediaWiki associates with a return value or function, such as time, site details, or page names. This page is about usage of standard magic words; for a complete list, see <span class="plainlinks">[http://www.mediawiki.org/wiki/Help:Magic_words mw:Help:Magic words]</span>.
  
<center>
+
==Behavior Switches==
{| {{Prettytable}}
+
{| class="wikitable" style="width:75%"
 +
!style="background:#A7C1F2;"|Input
 +
!style="width:50%;background:#A7C1F2;"|Description
 
|-
 
|-
!{{Hl3}}|'''Description'''
+
|<nowiki>__NOTOC__</nowiki>
!{{Hl3}}|'''You type'''
+
|Hides the table of contents (TOC).
!{{Hl3}}|'''You get'''
+
 
|-
 
|-
! {{Hl2}} colspan="3" | '''Date & Wiki variables'''
+
|<nowiki>__FORCETOC__</nowiki>
 +
|Forces TOC to appear.
 +
|-
 +
|<nowiki>__TOC__</nowiki>
 +
|Forces TOC to appear on the place you typed this.
 +
|-
 +
|<nowiki>__NOEDITSECTION__</nowiki>
 +
|Hides the [Edit] links on headers.
 +
|-
 +
|<nowiki>__NEWSECTIONLINK__</nowiki>
 +
|Adds a "+" on the top to add a new section.
 +
|-
 +
|<nowiki>__NOGALLERY__</nowiki>
 +
|Place this on a category to turn all Images in Links.
 +
|}
 +
 
 +
==Date & Page Variables==
 +
{| class="wikitable" style="width:75%"
 +
!style="background:#A7C1F2;"|Input
 +
!style="width:33%;background:#A7C1F2;"|Result
 +
!style="width:33%;background:#A7C1F2;"|Description
 
|-
 
|-
| Current month
 
 
|<nowiki>{{CURRENTMONTH}}</nowiki>  
 
|<nowiki>{{CURRENTMONTH}}</nowiki>  
 
|{{CURRENTMONTH}}
 
|{{CURRENTMONTH}}
 +
|The current month.
 
|-
 
|-
| Current month
 
 
|<nowiki>{{CURRENTMONTHNAME}}</nowiki>
 
|<nowiki>{{CURRENTMONTHNAME}}</nowiki>
 
|{{CURRENTMONTHNAME}}
 
|{{CURRENTMONTHNAME}}
 +
|Name of the current month.
 
|-
 
|-
| Genitive form<br>of current month name
 
|<nowiki>{{CURRENTMONTHNAMEGEN}}</nowiki>
 
|{{CURRENTMONTHNAMEGEN}}
 
|-
 
| Abbreviated month name
 
 
|<nowiki>{{CURRENTMONTHABBREV}}</nowiki>
 
|<nowiki>{{CURRENTMONTHABBREV}}</nowiki>
 
|{{CURRENTMONTHABBREV}}
 
|{{CURRENTMONTHABBREV}}
 +
|Abbreviated month name.
 
|-
 
|-
|Day of the month
 
 
|<nowiki>{{CURRENTDAY}}</nowiki>
 
|<nowiki>{{CURRENTDAY}}</nowiki>
 
|{{CURRENTDAY}}
 
|{{CURRENTDAY}}
 +
|Day of the month.
 
|-
 
|-
|Day of the week
 
 
|<nowiki>{{CURRENTDOW}}</nowiki>
 
|<nowiki>{{CURRENTDOW}}</nowiki>
 
|{{CURRENTDOW}}
 
|{{CURRENTDOW}}
 +
|Day of the week.
 
|-
 
|-
|Day of the week
 
 
|<nowiki>{{CURRENTDAYNAME}}</nowiki>
 
|<nowiki>{{CURRENTDAYNAME}}</nowiki>
 
|{{CURRENTDAYNAME}}
 
|{{CURRENTDAYNAME}}
 +
|Name of the current day.
 
|-
 
|-
| Week
 
 
|<nowiki>{{CURRENTWEEK}}</nowiki>
 
|<nowiki>{{CURRENTWEEK}}</nowiki>
 
|{{CURRENTWEEK}}
 
|{{CURRENTWEEK}}
 +
|The current week.
 
|-
 
|-
| Year
 
 
|<nowiki>{{CURRENTYEAR}}</nowiki>
 
|<nowiki>{{CURRENTYEAR}}</nowiki>
 
|{{CURRENTYEAR}}
 
|{{CURRENTYEAR}}
 +
|The current year.
 
|-
 
|-
| current time
 
 
|<nowiki>{{CURRENTTIME}}</nowiki>
 
|<nowiki>{{CURRENTTIME}}</nowiki>
 
|{{CURRENTTIME}}
 
|{{CURRENTTIME}}
 +
|The current time in HH:mm format.
 
|-
 
|-
| numbers of articles in this Wiki
 
 
|<nowiki>{{NUMBEROFARTICLES}}</nowiki>
 
|<nowiki>{{NUMBEROFARTICLES}}</nowiki>
 
|{{NUMBEROFARTICLES}}
 
|{{NUMBEROFARTICLES}}
 +
|The number of articles in this Wiki.
 
|-
 
|-
| numbers of uploaded files
 
 
|<nowiki>{{NUMBEROFFILES}}</nowiki>
 
|<nowiki>{{NUMBEROFFILES}}</nowiki>
 
|{{NUMBEROFFILES}}
 
|{{NUMBEROFFILES}}
 +
|The number of uploaded files.
 +
|}
 +
 +
==Namespaces==
 +
{|class="wikitable" style="width:75%"
 +
!style="background:#A7C1F2;"|Input
 +
!style="width:50%; background:#A7C1F2;"|Result
 
|-
 
|-
! {{Hl2}} colspan="3" | '''Namespaces'''
 
|-
 
|
 
 
|<nowiki>{{ns:-2}} or {{ns:Media}}</nowiki>
 
|<nowiki>{{ns:-2}} or {{ns:Media}}</nowiki>
 
|{{ns:-2}}
 
|{{ns:-2}}
 
|-
 
|-
|
 
 
|<nowiki>{{ns:-1}} or {{ns:Special}}</nowiki>
 
|<nowiki>{{ns:-1}} or {{ns:Special}}</nowiki>
 
|{{ns:-1}}
 
|{{ns:-1}}
 
|-
 
|-
|
 
 
|<nowiki>{{ns:1}} or {{ns:Talk}}</nowiki>
 
|<nowiki>{{ns:1}} or {{ns:Talk}}</nowiki>
 
| {{ns:1}}
 
| {{ns:1}}
 
|-
 
|-
|
 
 
| <nowiki>{{ns:2}} or {{ns:User}}</nowiki>
 
| <nowiki>{{ns:2}} or {{ns:User}}</nowiki>
 
| {{ns:2}}
 
| {{ns:2}}
 
|-
 
|-
|
 
 
| <nowiki>{{ns:3}} or {{ns:User_talk}}</nowiki>
 
| <nowiki>{{ns:3}} or {{ns:User_talk}}</nowiki>
 
| {{ns:3}}
 
| {{ns:3}}
 
|-
 
|-
|
 
 
| <nowiki>{{ns:4}} or {{ns:Project}}</nowiki>
 
| <nowiki>{{ns:4}} or {{ns:Project}}</nowiki>
 
| {{ns:4}}
 
| {{ns:4}}
 
|-
 
|-
|
 
 
| <nowiki>{{ns:5}} or {{ns:Project_talk}}</nowiki>
 
| <nowiki>{{ns:5}} or {{ns:Project_talk}}</nowiki>
 
| {{ns:5}}
 
| {{ns:5}}
 
|-
 
|-
|
 
 
| <nowiki>{{ns:6}} or {{ns:Image}}</nowiki>
 
| <nowiki>{{ns:6}} or {{ns:Image}}</nowiki>
 
| {{ns:6}}
 
| {{ns:6}}
 
|-
 
|-
|
 
 
| <nowiki>{{ns:7}} or {{ns:Image_talk}}</nowiki>
 
| <nowiki>{{ns:7}} or {{ns:Image_talk}}</nowiki>
 
| {{ns:7}}
 
| {{ns:7}}
 
|-
 
|-
|
 
 
| <nowiki>{{ns:8}} or {{ns:MediaWiki}}</nowiki>
 
| <nowiki>{{ns:8}} or {{ns:MediaWiki}}</nowiki>
 
| {{ns:8}}
 
| {{ns:8}}
 
|-
 
|-
|
 
 
| <nowiki>{{ns:9}} or {{ns:MediaWiki_talk}}</nowiki>
 
| <nowiki>{{ns:9}} or {{ns:MediaWiki_talk}}</nowiki>
 
| {{ns:9}}
 
| {{ns:9}}
 
|-
 
|-
|
 
 
| <nowiki>{{ns:10}} or {{ns:Template}}</nowiki>
 
| <nowiki>{{ns:10}} or {{ns:Template}}</nowiki>
 
| {{ns:10}}
 
| {{ns:10}}
 
|-
 
|-
|
 
 
| <nowiki>{{ns:11}} or {{ns:Template_talk}}</nowiki>
 
| <nowiki>{{ns:11}} or {{ns:Template_talk}}</nowiki>
 
| {{ns:11}}
 
| {{ns:11}}
 
|-
 
|-
|
 
 
| <nowiki>{{ns:12}} or {{ns:Help}}</nowiki>
 
| <nowiki>{{ns:12}} or {{ns:Help}}</nowiki>
 
| {{ns:12}}
 
| {{ns:12}}
 
|-
 
|-
|
 
 
| <nowiki>{{ns:13}} or {{ns:Help_talk}}</nowiki>
 
| <nowiki>{{ns:13}} or {{ns:Help_talk}}</nowiki>
 
| {{ns:13}}
 
| {{ns:13}}
 
|-
 
|-
|
 
 
| <nowiki>{{ns:14}} or {{ns:Category}}</nowiki>
 
| <nowiki>{{ns:14}} or {{ns:Category}}</nowiki>
 
| {{ns:14}}
 
| {{ns:14}}
 
|-
 
|-
|
 
 
| <nowiki>{{ns:15}} or {{ns:Category_talk}}</nowiki>
 
| <nowiki>{{ns:15}} or {{ns:Category_talk}}</nowiki>
 
| {{ns:15}}
 
| {{ns:15}}
 +
|}
 +
 +
==Server specific==
 +
{|class="wikitable" style="width:75%"
 +
!style="background:#A7C1F2;"|Input
 +
!style="width:33%;background:#A7C1F2;"|Result
 +
!style="width:33%;background:#A7C1F2;"|Description
 
|-
 
|-
! {{Hl2}} colspan="3" | '''Server specific'''
 
|-
 
| Sitename
 
 
| <nowiki>{{SITENAME}}</nowiki>
 
| <nowiki>{{SITENAME}}</nowiki>
 
| {{SITENAME}}
 
| {{SITENAME}}
 +
|Name of the site.
 
|-
 
|-
| Servername
 
 
| <nowiki>{{SERVERNAME}}</nowiki>
 
| <nowiki>{{SERVERNAME}}</nowiki>
 
| {{SERVERNAME}}
 
| {{SERVERNAME}}
 +
|Name of the server.
 
|-
 
|-
| Server
 
 
| <nowiki>{{SERVER}}</nowiki>
 
| <nowiki>{{SERVER}}</nowiki>
 
| {{SERVER}}
 
| {{SERVER}}
 +
|Link to the server.
 
|-
 
|-
|-
 
| Script path
 
| <nowiki>{{SCRIPTPATH}}</nowiki>
 
| {{SCRIPTPATH}}
 
|-
 
| Local part of the URL<br>
 
 
| <nowiki>{{localurl:pagename}}</nowiki>
 
| <nowiki>{{localurl:pagename}}</nowiki>
 
| {{localurl:pagename}}
 
| {{localurl:pagename}}
|-
 
 
|
 
|
 +
|-
 
| <nowiki>{{localurl:pagename|</nowiki>''query string''<nowiki>}}</nowiki>
 
| <nowiki>{{localurl:pagename|</nowiki>''query string''<nowiki>}}</nowiki>
 
| {{localurl:pagename|''query string''}}
 
| {{localurl:pagename|''query string''}}
 +
|
 +
|}
 +
 +
==Page related==
 +
{| class="wikitable" style="width:75%"
 
|-
 
|-
! {{Hl2}} colspan="3" | '''Page related'''
+
!style="background:#A7C1F2;"|Input
 +
!style="width:33%;background:#A7C1F2;"|Result
 +
!style="width:33%;background:#A7C1F2;"|Description
 
|-
 
|-
| Pagename
 
 
| <nowiki>{{PAGENAME}}</nowiki>
 
| <nowiki>{{PAGENAME}}</nowiki>
 
| {{PAGENAME}}
 
| {{PAGENAME}}
 +
|Pagename without Namespace.
 
|-
 
|-
| Pagename<br>(URL encoded)
 
 
| <nowiki>{{PAGENAMEE}}</nowiki>
 
| <nowiki>{{PAGENAMEE}}</nowiki>
 
| {{PAGENAMEE}}
 
| {{PAGENAMEE}}
 +
|URL encoded pagename.
 
|-
 
|-
| Namespace
 
 
| <nowiki>{{NAMESPACE}}</nowiki>
 
| <nowiki>{{NAMESPACE}}</nowiki>
 
| {{NAMESPACE}}
 
| {{NAMESPACE}}
 +
|Current Namespace.
 +
|-
 +
| <nowiki>{{SUBJECTSPACE}}</nowiki>
 +
| {{SUBJECTSPACE}}
 +
|Associated Subjectspace.
 +
|-
 +
| <nowiki>{{TALKSPACE}}</nowiki>
 +
| {{TALKSPACE}}
 +
|Associated Talkspace.
 +
|-
 +
| <nowiki>{{FULLPAGENAME}}</nowiki>
 +
| {{FULLPAGENAME}}
 +
|Pagename with Namespace.
 
|-
 
|-
| Revision ID
 
 
| <nowiki>{{REVISIONID}}</nowiki>
 
| <nowiki>{{REVISIONID}}</nowiki>
 
| {{REVISIONID}}
 
| {{REVISIONID}}
 +
|The unique revision ID.
 
|}
 
|}
</center>
 
 
==External links==
 
MetaWiki: [http://meta.wikimedia.org/wiki/Help:Variable Help:Variable]
 
  
 
[[Category:Help|Variables]]
 
[[Category:Help|Variables]]

Revision as of 10:59, 19 September 2010

Magic words are strings of text that MediaWiki associates with a return value or function, such as time, site details, or page names. This page is about usage of standard magic words; for a complete list, see mw:Help:Magic words.

Behavior Switches

Input Description
__NOTOC__ Hides the table of contents (TOC).
__FORCETOC__ Forces TOC to appear.
__TOC__ Forces TOC to appear on the place you typed this.
__NOEDITSECTION__ Hides the [Edit] links on headers.
__NEWSECTIONLINK__ Adds a "+" on the top to add a new section.
__NOGALLERY__ Place this on a category to turn all Images in Links.

Date & Page Variables

Input Result Description
{{CURRENTMONTH}} 11 The current month.
{{CURRENTMONTHNAME}} November Name of the current month.
{{CURRENTMONTHABBREV}} Nov Abbreviated month name.
{{CURRENTDAY}} 22 Day of the month.
{{CURRENTDOW}} 5 Day of the week.
{{CURRENTDAYNAME}} Friday Name of the current day.
{{CURRENTWEEK}} 47 The current week.
{{CURRENTYEAR}} 2024 The current year.
{{CURRENTTIME}} 14:38 The current time in HH:mm format.
{{NUMBEROFARTICLES}} 994 The number of articles in this Wiki.
{{NUMBEROFFILES}} 1,072 The number of uploaded files.

Namespaces

Input Result
{{ns:-2}} or {{ns:Media}} Media
{{ns:-1}} or {{ns:Special}} Special
{{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}} WikiTemp
{{ns:5}} or {{ns:Project_talk}} WikiTemp talk
{{ns:6}} or {{ns:Image}} File
{{ns:7}} or {{ns:Image_talk}} File 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

Server specific

Input Result Description
{{SITENAME}} WikiTemp Name of the site.
{{SERVERNAME}} wiki.gbatemp.net Name of the server.
{{SERVER}} //wiki.gbatemp.net Link to the server.
{{localurl:pagename}} /wiki/Pagename
{{localurl:pagename|query string}} /wiki/Pagename?query string

Page related

Input Result Description
{{PAGENAME}} Magic words Pagename without Namespace.
{{PAGENAMEE}} Magic_words URL encoded pagename.
{{NAMESPACE}} Help Current Namespace.
{{SUBJECTSPACE}} Help Associated Subjectspace.
{{TALKSPACE}} Help talk Associated Talkspace.
{{FULLPAGENAME}} Help:Magic words Pagename with Namespace.
{{REVISIONID}} 36131 The unique revision ID.