Difference between revisions of "Help:Magic words"
(more link fixage) |
|||
| Line 2: | Line 2: | ||
== Table of contents == | == Table of contents == | ||
| − | :''For details | + | :''For details look it up with Google or at Mediawiki or Wikipedia.'' |
{| class="wikitable" border="2" cellpadding="4" cellspacing="0" width="79%" | {| class="wikitable" border="2" cellpadding="4" cellspacing="0" width="79%" | ||
! Word | ! Word | ||
| Line 45: | Line 45: | ||
== Variables == | == Variables == | ||
| − | :''For details | + | :''For details look it up with Google or at Mediawiki or Wikipedia.'' |
===Time=== | ===Time=== | ||
| − | The time in | + | The time in UTC. |
{| class="wikitable sortable" border="2" cellpadding="4" cellspacing="0" | {| class="wikitable sortable" border="2" cellpadding="4" cellspacing="0" | ||
! Word | ! Word | ||
| Line 101: | Line 101: | ||
| <code>{{CURRENTTIMESTAMP}}</code> | | <code>{{CURRENTTIMESTAMP}}</code> | ||
| '''[MW1.7+]''' [[w:en:ISO 8601|ISO 8601]] time stamp. | | '''[MW1.7+]''' [[w:en:ISO 8601|ISO 8601]] time stamp. | ||
| − | | | + | |} |
===Local time=== | ===Local time=== | ||
| Line 157: | Line 157: | ||
| <code>{{LOCALTIMESTAMP}}</code> | | <code>{{LOCALTIMESTAMP}}</code> | ||
| [[w:en:ISO 8601|ISO 8601]] time stamp. | | [[w:en:ISO 8601|ISO 8601]] time stamp. | ||
| − | | | + | |} |
| − | *See also the | + | *See also the ParserFunction #time: (Again, look it up elsewhere.) |
=== Statistics === | === Statistics === | ||
| Line 169: | Line 169: | ||
| <nowiki>{{CURRENTVERSION}}</nowiki> | | <nowiki>{{CURRENTVERSION}}</nowiki> | ||
| <code>{{CURRENTVERSION}}</code> | | <code>{{CURRENTVERSION}}</code> | ||
| − | | '''[MW1.7+]''' | + | | '''[MW1.7+]''' [http://mail.wikipedia.org/pipermail/mediawiki-i18n/2006-May/000026.html] |
|- | |- | ||
| <nowiki>{{NUMBEROFARTICLES}}</nowiki><br /><nowiki>{{NUMBEROFARTICLES:R}}</nowiki> | | <nowiki>{{NUMBEROFARTICLES}}</nowiki><br /><nowiki>{{NUMBEROFARTICLES:R}}</nowiki> | ||
| <code>{{NUMBEROFARTICLES}}</code><br /><code>{{NUMBEROFARTICLES:R}}</code> | | <code>{{NUMBEROFARTICLES}}</code><br /><code>{{NUMBEROFARTICLES:R}}</code> | ||
| − | | A | + | | A variable which returns the total number of articles on the Wiki. |
|- | |- | ||
| <nowiki>{{NUMBEROFPAGES}}</nowiki><br /><nowiki>{{NUMBEROFPAGES:R}}</nowiki> | | <nowiki>{{NUMBEROFPAGES}}</nowiki><br /><nowiki>{{NUMBEROFPAGES:R}}</nowiki> | ||
| Line 192: | Line 192: | ||
|- | |- | ||
| <nowiki>{{PAGESINNAMESPACE}}</nowiki> | | <nowiki>{{PAGESINNAMESPACE}}</nowiki> | ||
| − | + | | <font color="red">'''disabled here'''</font> | |
| Longer alias of PAGESINNS | | Longer alias of PAGESINNS | ||
|- | |- | ||
| <nowiki>{{PAGESINNS:ns}}</nowiki><br /><nowiki>{{PAGESINNS:ns:R}}</nowiki> | | <nowiki>{{PAGESINNS:ns}}</nowiki><br /><nowiki>{{PAGESINNS:ns:R}}</nowiki> | ||
| − | | | + | | <font color="red">'''disabled here'''</font> |
| − | | '''[MW1.7+]''' Returns the number of pages in the given namespace. Disabled by default, enable with | + | | '''[MW1.7+]''' Returns the number of pages in the given namespace. Disabled by default, enable with AllowSlowParserFunctions. |
| − | | | + | |} |
=== Page names and related info === | === Page names and related info === | ||
| Line 216: | Line 216: | ||
| <nowiki>{{SUBPAGENAME}}</nowiki><br /><nowiki>{{SUBPAGENAMEE}}</nowiki> | | <nowiki>{{SUBPAGENAME}}</nowiki><br /><nowiki>{{SUBPAGENAMEE}}</nowiki> | ||
| <code>{{SUBPAGENAME}}<br />{{SUBPAGENAMEE}}</code> | | <code>{{SUBPAGENAME}}<br />{{SUBPAGENAMEE}}</code> | ||
| − | | '''[MW1.6+]''' Name of the current page, excluding parent pages ("Subtitle" on "Title/Other/Subtitle") in namespaces supporting subpages, see [[Help: | + | | '''[MW1.6+]''' Name of the current page, excluding parent pages ("Subtitle" on "Title/Other/Subtitle") in namespaces supporting subpages, see [[Help:Links|Help:Links]]. |
|- | |- | ||
| <nowiki>{{BASEPAGENAME}}</nowiki><br ><nowiki>{{BASEPAGENAMEE}}</nowiki> | | <nowiki>{{BASEPAGENAME}}</nowiki><br ><nowiki>{{BASEPAGENAMEE}}</nowiki> | ||
| <code>{{BASEPAGENAME}}<br />{{BASEPAGENAMEE}}</code> | | <code>{{BASEPAGENAME}}<br />{{BASEPAGENAMEE}}</code> | ||
| − | | '''[MW1.7+]''' The basename of a subpage ("Title/Other" on "Title/Other/Subtitle"), see [[Help: | + | | '''[MW1.7+]''' The basename of a subpage ("Title/Other" on "Title/Other/Subtitle"), see [[Help:Links|Help:Links]]. |
|- | |- | ||
| <nowiki>{{NAMESPACE}}</nowiki><br /><nowiki>{{NAMESPACEE}}</nowiki> | | <nowiki>{{NAMESPACE}}</nowiki><br /><nowiki>{{NAMESPACEE}}</nowiki> | ||
| Line 256: | Line 256: | ||
| <nowiki>{{REVISIONID}}</nowiki> | | <nowiki>{{REVISIONID}}</nowiki> | ||
| <code>{{REVISIONID}}</code> | | <code>{{REVISIONID}}</code> | ||
| − | | '''[MW1.5+]''' The unique identifying number of a page | + | | '''[MW1.5+]''' The unique identifying number of a page revision. |
|- | |- | ||
| <nowiki>{{REVISIONDAY}}</nowiki> | | <nowiki>{{REVISIONDAY}}</nowiki> | ||
| Line 280: | Line 280: | ||
| <nowiki>{{SITENAME}}</nowiki> | | <nowiki>{{SITENAME}}</nowiki> | ||
| <code>{{SITENAME}}</code> | | <code>{{SITENAME}}</code> | ||
| − | | | + | | As given in config file. |
|- | |- | ||
| <nowiki>{{SERVER}}</nowiki> | | <nowiki>{{SERVER}}</nowiki> | ||
| <small>{{SERVER}}</small> | | <small>{{SERVER}}</small> | ||
| − | | | + | | As given in config file. |
|- | |- | ||
| <nowiki>{{SCRIPTPATH}}</nowiki> | | <nowiki>{{SCRIPTPATH}}</nowiki> | ||
| <code>{{SCRIPTPATH}}</code> | | <code>{{SCRIPTPATH}}</code> | ||
| − | | '''[MW1.5+]''' | + | | '''[MW1.5+]''' As given in config file. |
|- | |- | ||
| <nowiki>{{SERVERNAME}}</nowiki> | | <nowiki>{{SERVERNAME}}</nowiki> | ||
| <code>{{SERVERNAME}}</code> | | <code>{{SERVERNAME}}</code> | ||
| − | | '''[MW1.5+]''' | + | | '''[MW1.5+]''' As given in config file. |
|- | |- | ||
| − | | | + | |} |
==Parser functions== | ==Parser functions== | ||
| − | :''For details | + | :''For details blah blah blah'' |
=== Namespaces and URLs === | === Namespaces and URLs === | ||
| Line 308: | Line 308: | ||
| <nowiki>{{ns:}}</nowiki> | | <nowiki>{{ns:}}</nowiki> | ||
| <nowiki>{{ns:4}}</nowiki> = <code>{{ns:4}}</code><br /><nowiki>{{ns:project}}</nowiki> = <code>{{ns:project}}</code> | | <nowiki>{{ns:4}}</nowiki> = <code>{{ns:4}}</code><br /><nowiki>{{ns:project}}</nowiki> = <code>{{ns:project}}</code> | ||
| − | | Returns the name of a given | + | | Returns the name of a given namespace number. |
|- | |- | ||
| <nowiki>{{localurl:x y @}}</nowiki><br /><nowiki>{{localurle:x y @}}</nowiki><br /><nowiki>{{localurl:a|b=c}}</nowiki> | | <nowiki>{{localurl:x y @}}</nowiki><br /><nowiki>{{localurle:x y @}}</nowiki><br /><nowiki>{{localurl:a|b=c}}</nowiki> | ||
| <code>{{localurl:x y @}}<br />{{localurle:x y @}}<br />{{localurl:a|b=c}}</code> | | <code>{{localurl:x y @}}<br />{{localurle:x y @}}<br />{{localurl:a|b=c}}</code> | ||
| − | | Returns the local URL of a page (might not exist). Optional ''query'' parameter | + | | Returns the local URL of a page (might not exist). Optional ''query'' parameter. |
|- <!-- intentionally nbsp instead of sp for formatting reasons --> | |- <!-- intentionally nbsp instead of sp for formatting reasons --> | ||
| <nowiki>{{urlencode:x y @}}</nowiki> | | <nowiki>{{urlencode:x y @}}</nowiki> | ||
| Line 325: | Line 325: | ||
| <small>{{fullurl:x y @}}<br />{{fullurle:x y @}}<br />{{fullurl:m:a|b=c}}</small> | | <small>{{fullurl:x y @}}<br />{{fullurle:x y @}}<br />{{fullurl:m:a|b=c}}</small> | ||
| '''[MW1.5+]''' Returns the full URL of a given page. Optional ''query'' parameter as for <tt>localurl:</tt>. | | '''[MW1.5+]''' Returns the full URL of a given page. Optional ''query'' parameter as for <tt>localurl:</tt>. | ||
| − | | | + | |} |
=== Formatting === | === Formatting === | ||
| Line 360: | Line 360: | ||
| <nowiki>{{padleft:bcd|6|a}}</nowiki> = <code>{{padleft:bcd|6|a}}</code><br /><nowiki>{{padright:bcd|6|a}}</nowiki> = <code>{{padright:bcd|6|a}}</code> | | <nowiki>{{padleft:bcd|6|a}}</nowiki> = <code>{{padleft:bcd|6|a}}</code><br /><nowiki>{{padright:bcd|6|a}}</nowiki> = <code>{{padright:bcd|6|a}}</code> | ||
| '''[MW1.8+]''' Pads a string with a character to the specified width. | | '''[MW1.8+]''' Pads a string with a character to the specified width. | ||
| − | | | + | |} |
| − | Padding does not seem to work for characters with a multi-character code, such as &nbsp;, which would be useful with padleft for | + | Padding does not seem to work for characters with a multi-character code, such as &nbsp;, which would be useful with padleft for sorting tables with Javascript. |
== Template modifiers == | == Template modifiers == | ||
| Line 373: | Line 373: | ||
|- | |- | ||
| <nowiki>{{int:xyz}}</nowiki> | | <nowiki>{{int:xyz}}</nowiki> | ||
| − | | Shorthand for <nowiki>{{MediaWiki:xyz}}</nowiki>, rendered as {{int:xyz}} if [[MediaWiki:xyz]] doesn't exist | + | | Shorthand for <nowiki>{{MediaWiki:xyz}}</nowiki>, rendered as {{int:xyz}} if <nowiki>[[MediaWiki:xyz]]</nowiki> doesn't exist. |
|- | |- | ||
| <nowiki>{{msg:xyz}}</nowiki> | | <nowiki>{{msg:xyz}}</nowiki> | ||
| Line 379: | Line 379: | ||
|- | |- | ||
| <nowiki>{{msgnw:xyz}}</nowiki> | | <nowiki>{{msgnw:xyz}}</nowiki> | ||
| − | | The unevaluated wikitext is rendered. | + | | The unevaluated wikitext is rendered. Look up msgnw. |
|- | |- | ||
| <nowiki>{{raw:xyz}}</nowiki> | | <nowiki>{{raw:xyz}}</nowiki> | ||
| Line 385: | Line 385: | ||
|- | |- | ||
| <nowiki>{{subst:xyz}}</nowiki> | | <nowiki>{{subst:xyz}}</nowiki> | ||
| − | | In the wikitext, the tag is substituted by the ''content'' (single-level evaluation only) | + | | In the wikitext, the tag is substituted by the ''content'' (single-level evaluation only). |
| − | | | + | |} |
== Image modifiers == | == Image modifiers == | ||
:''For details see [[w:en:Wikipedia:Extended image syntax]].'' | :''For details see [[w:en:Wikipedia:Extended image syntax]].'' | ||
| − | These are | + | These are image modifiers used in <code><nowiki>[[Image:title.ext|modifier|...|modifier]]</nowiki></code> links. Some are mutually exclusive, and then the last specified wins. |
=== Size === | === Size === | ||
| Line 414: | Line 414: | ||
| <nowiki>[[Image:Mediawiki.png|40px]]</nowiki> | | <nowiki>[[Image:Mediawiki.png|40px]]</nowiki> | ||
| Scales image to given ''width''  in pixels | | Scales image to given ''width''  in pixels | ||
| − | | | + | |} |
=== Position === | === Position === | ||
| − | |||
The positions are mutually exclusive, the last specified wins. [[:Template:-]] can stop floating. For inline images only modifier ''px'' (see above) is supported. | The positions are mutually exclusive, the last specified wins. [[:Template:-]] can stop floating. For inline images only modifier ''px'' (see above) is supported. | ||
{| class="wikitable" border="2" cellpadding="4" cellspacing="0" width="100%" | {| class="wikitable" border="2" cellpadding="4" cellspacing="0" width="100%" | ||
| Line 439: | Line 438: | ||
| <nowiki>[[Image:Mediawiki.png|center]]</nowiki> | | <nowiki>[[Image:Mediawiki.png|center]]</nowiki> | ||
| Modifies position, like ''none'' but centered. | | Modifies position, like ''none'' but centered. | ||
| − | | | + | |} |
== Miscellany == | == Miscellany == | ||
| Line 450: | Line 449: | ||
| <nowiki>{{DISPLAYTITLE:</nowiki>''xyz''<nowiki>}}</nowiki> | | <nowiki>{{DISPLAYTITLE:</nowiki>''xyz''<nowiki>}}</nowiki> | ||
| <font color="red">'''default disabled'''</font> | | <font color="red">'''default disabled'''</font> | ||
| − | | '''[MW 1.7+]''' Set the page's title [http://svn.wikimedia.org/viewvc/mediawiki?view=rev&revision=13572], see | + | | '''[MW 1.7+]''' Set the page's title [http://svn.wikimedia.org/viewvc/mediawiki?view=rev&revision=13572], see AllowDisplayTitle. |
|- | |- | ||
| <nowiki>{{DIRMARK}}</nowiki><br /><nowiki>{{DIRECTIONMARK}}</nowiki> | | <nowiki>{{DIRMARK}}</nowiki><br /><nowiki>{{DIRECTIONMARK}}</nowiki> | ||
| Line 458: | Line 457: | ||
| <nowiki>{{CONTENTLANGUAGE}}</nowiki> | | <nowiki>{{CONTENTLANGUAGE}}</nowiki> | ||
| <code>{{CONTENTLANGUAGE}}</code> | | <code>{{CONTENTLANGUAGE}}</code> | ||
| − | | '''[MW1.7+]''' Default content | + | | '''[MW1.7+]''' Default content LanguageCode |
|- | |- | ||
| <nowiki>#redirect</nowiki> | | <nowiki>#redirect</nowiki> | ||
| <code>#REDIRECT [[target]]</code><br />at top of source page | | <code>#REDIRECT [[target]]</code><br />at top of source page | ||
| − | | Creates a | + | | Creates a redirect to another page. |
| − | | | + | |} |
===Language-dependent word conversions=== | ===Language-dependent word conversions=== | ||
| Line 476: | Line 475: | ||
|- | |- | ||
| {{grammar:''case | word'' }} | | {{grammar:''case | word'' }} | ||
| − | | <nowiki>{{grammar:7sg|Wikipedie}}</nowiki><br />on | + | | <nowiki>{{grammar:7sg|Wikipedie}}</nowiki><br />on cs is <code>Wikipedií</code>. |
| − | | Derived word forms in inflected languages like | + | | Derived word forms in inflected languages like Czech [http://svn.wikimedia.org/svnroot/mediawiki/trunk/phase3/languages/LanguageCs.php] |
|- | |- | ||
| {{plural:''count |form1 |form2'' }}<br />{{plural:''count |1st | 2nd | 3rd ''}} | | {{plural:''count |form1 |form2'' }}<br />{{plural:''count |1st | 2nd | 3rd ''}} | ||
| <nowiki>{{plural: 2 | is | are }}</nowiki><br />outputs <code>{{plural: 2 | is |are }}</code><br /><nowiki>{{plural: 0 | this | these }}</nowiki><br />outputs <code>{{plural: 0 |this | these }}</code> | | <nowiki>{{plural: 2 | is | are }}</nowiki><br />outputs <code>{{plural: 2 | is |are }}</code><br /><nowiki>{{plural: 0 | this | these }}</nowiki><br />outputs <code>{{plural: 0 |this | these }}</code> | ||
| − | | ''count'' '''1''' yields ''form1'' (singular), [[w:Plural|plural]] transformations are used for languages like | + | | ''count'' '''1''' yields ''form1'' (singular), [[w:Plural|plural]] transformations are used for languages like Russian [http://svn.wikimedia.org/svnroot/mediawiki/trunk/phase3/languages/LanguageRu.php] based on "count mod 10". |
| − | | | + | |} |
"Grammar" and "Plural" are language-dependent functions, defined in [http://svn.wikimedia.org/svnroot/mediawiki/trunk/phase3/languages/LanguageCs.php], [http://svn.wikimedia.org/svnroot/mediawiki/trunk/phase3/languages/LanguageRu.php], etc. (note that in PHP, the modulo operator is the percent sign). | "Grammar" and "Plural" are language-dependent functions, defined in [http://svn.wikimedia.org/svnroot/mediawiki/trunk/phase3/languages/LanguageCs.php], [http://svn.wikimedia.org/svnroot/mediawiki/trunk/phase3/languages/LanguageRu.php], etc. (note that in PHP, the modulo operator is the percent sign). | ||
| − | "Grammar" can either be applied to predefined words only, or to arbitrary words, depending on whether the definition is just a 2D array, or involves string manipulations | + | "Grammar" can either be applied to predefined words only, or to arbitrary words, depending on whether the definition is just a 2D array, or involves string manipulations. |
"Plural" is a project-dependent switch function, e.g. giving the first text if ''count'' = 1, the second if ''count'' = 2,3, or 4, and else the third. | "Plural" is a project-dependent switch function, e.g. giving the first text if ''count'' = 1, the second if ''count'' = 2,3, or 4, and else the third. | ||
| Line 492: | Line 491: | ||
===See also=== | ===See also=== | ||
| − | * | + | *Parser functions '''#expr:''', '''#if:''', '''#ifeq:''', etc. |
*[http://svn.wikimedia.org/svnroot/mediawiki/trunk/phase3/languages/Language.php Source for Language.php] | *[http://svn.wikimedia.org/svnroot/mediawiki/trunk/phase3/languages/Language.php Source for Language.php] | ||
*[http://svn.wikimedia.org/svnroot/mediawiki/trunk/phase3/includes/MagicWord.php Source for MagicWord.php] | *[http://svn.wikimedia.org/svnroot/mediawiki/trunk/phase3/includes/MagicWord.php Source for MagicWord.php] | ||
| − | |||
| − | |||
Latest revision as of 19:54, January 3, 2007
This is an organised index of Magic words used in MediaWiki. Tags such as "[MW1.5+]" indicate the version that first supported the magic word. "XYZ" indicates user input, which is used in the example.
Table of contents
- For details look it up with Google or at Mediawiki or Wikipedia.
| Word | Explanation |
|---|---|
| __NOTOC__ | Hides ToC on the current page. |
| __FORCETOC__ | Forces the table of contents to appear. |
| __TOC__ | Places a ToC here (overriding any __NOTOC__). |
More magic
| Word | Explanation |
|---|---|
| __NOEDITSECTION__ | Hides the edit links beside headings. |
| __NEWSECTIONLINK__ | [MW1.7+] Gives a "+"-link next to the edit-tab to make a new section on a non-talk page. |
| __NOCONTENTCONVERT__ __NOCC__ |
Don't perform the content language conversion (character and phase) in article display; for example, Chinese zh with zh_cn, zh_tw, zh_sg, zh_hk. |
| __NOGALLERY__ | [MW1.7+] This magic word allows images in category pages to be displayed as inline links instead of gallery. |
| __NOTITLECONVERT__ __NOTC__ |
Like __NOCC__ but affecting article title only. |
| __END__ | Allows for trailing whitespace to be included in the page save. |
| __START__ | This magic word has no effect but an ID in MagicWord.php (MAG_START).
|
Variables
- For details look it up with Google or at Mediawiki or Wikipedia.
Time
The time in UTC.
| Word | Example | Explanation |
|---|---|---|
| {{CURRENTDAY}} | 5
|
Displays the current day in numeric form. |
| {{CURRENTDAY2}} | 05
|
[MW1.6+] Same as {{CURRENTDAY}}, but with leading zero (01 .. 31). |
| {{CURRENTDAYNAME}} | Friday
|
Name of the day in the language of the project or English. |
| {{CURRENTDOW}} | 5
|
Same as {{CURRENTDAYNAME}}, but as a number (0=Sunday, 1=Monday...). |
| {{CURRENTMONTH}} | 12
|
The number 01 .. 12 of the month. |
| {{CURRENTMONTHABBREV}} | Dec
|
[MW1.5+] Same as {{CURRENTMONTH}}, but in abbreviated form as Jan .. Dec. |
| {{CURRENTMONTHNAME}} | December
|
Same as {{CURRENTMONTH}}, but in named form January .. December. |
| {{CURRENTTIME}} | 18:21
|
The current time (00:00 .. 23:59). |
| {{CURRENTHOUR}} | 18
|
The current hour (00 .. 23). |
| {{CURRENTWEEK}} | 49
|
Number of the current week (1-53) according to ISO 8601 with no leading zero. |
| {{CURRENTYEAR}} | 2025
|
Returns the current year. |
| {{CURRENTTIMESTAMP}} | 20251205182151
|
[MW1.7+] ISO 8601 time stamp. |
Local time
The time depending on the local timezone of the wiki. (All words [MW1.8+] )
| Word | Example | Explanation |
|---|---|---|
| {{LOCALDAY}} | 5
|
Displays the local day of the month in numeric form. |
| {{LOCALDAY2}} | 05
|
Same as {{LOCALDAY}}, but with a leading zero (01 .. 31). |
| {{LOCALDAYNAME}} | Friday
|
Name of the day in the language of the project or English. |
| {{LOCALDOW}} | 5
|
Same as {{LOCALDAYNAME}}, but as a number (0=Sunday, 1=Monday...). |
| {{LOCALMONTH}} | 12
|
The number 01 .. 12 of the month. |
| {{LOCALMONTHABBREV}} | Dec
|
Same as {{LOCALMONTH}}, but in abbreviated form as Jan .. Dec. |
| {{LOCALMONTHNAME}} | December
|
Same as {{LOCALMONTH}}, but in named form as January .. December. |
| {{LOCALTIME}} | 10:21
|
The local time (00:00 .. 23:59). |
| {{LOCALHOUR}} | 10
|
The local hour (00 .. 23). |
| {{LOCALWEEK}} | 49
|
Number of the local week (1-53) according to ISO 8601 with no leading zero. |
| {{LOCALYEAR}} | 2025
|
Returns the local year. |
| {{LOCALTIMESTAMP}} | 20251205102151
|
ISO 8601 time stamp. |
- See also the ParserFunction #time: (Again, look it up elsewhere.)
Statistics
| Word | Example | Explanation |
|---|---|---|
| {{CURRENTVERSION}} | 1.35.11
|
[MW1.7+] [1] |
| {{NUMBEROFARTICLES}} {{NUMBEROFARTICLES:R}} |
1,1581158
|
A variable which returns the total number of articles on the Wiki. |
| {{NUMBEROFPAGES}} {{NUMBEROFPAGES:R}} |
2,2202220
|
[MW1.7+] Returns the total number of pages. [2] |
| {{NUMBEROFFILES}} {{NUMBEROFFILES:R}} |
183183
|
[MW1.5+] Returns the number of uploaded files (rows in the image table). |
| {{NUMBEROFUSERS}} {{NUMBEROFUSERS:R}} |
101101
|
[MW1.7+] Returns the number of registered users (rows in the user table). |
| {{NUMBEROFADMINS}} {{NUMBEROFADMINS:R}} |
55
|
[MW1.7+] Returns the number of administrators (sysop, bureaucrat, steward and checkuser). |
| {{PAGESINNAMESPACE}} | disabled here | Longer alias of PAGESINNS |
| {{PAGESINNS:ns}} {{PAGESINNS:ns:R}} |
disabled here | [MW1.7+] Returns the number of pages in the given namespace. Disabled by default, enable with AllowSlowParserFunctions. |
| Word | Example | Explanation |
|---|---|---|
| {{PAGENAME}} | Magic words
|
Returns the name of the current page, including all levels (Title/Subtitle). |
| {{PAGENAMEE}} | Magic_words
|
More URL-friendly percent encoded special characters (To use an articlename in an external link). |
| {{SUBPAGENAME}} {{SUBPAGENAMEE}} |
Magic words
|
[MW1.6+] Name of the current page, excluding parent pages ("Subtitle" on "Title/Other/Subtitle") in namespaces supporting subpages, see Help:Links. |
| {{BASEPAGENAME}} {{BASEPAGENAMEE}} |
Magic words
|
[MW1.7+] The basename of a subpage ("Title/Other" on "Title/Other/Subtitle"), see Help:Links. |
| {{NAMESPACE}} {{NAMESPACEE}} |
Help
|
Returns the name of the namespace the current page resides in. |
| {{FULLPAGENAME}} {{FULLPAGENAMEE}} |
Help:Magic words
|
[MW1.6+] Shorthands for NAMESPACE+PAGENAME |
| {{TALKSPACE}} {{TALKSPACEE}} |
Help talk
|
[MW1.7+] Name of next odd namespace (e.g. 4 => 5) |
| {{SUBJECTSPACE}} {{SUBJECTSPACEE}} |
Help
|
[MW1.7+] Name of last even namespace (e.g. 5 => 4) |
| {{ARTICLESPACE}} {{ARTICLESPACEE}} |
Help
|
[MW1.7+] An alias for SUBJECTSPACE(E) |
| {{TALKPAGENAME}} {{TALKPAGENAMEE}} |
Help talk:Magic words
|
[MW1.7+] FULLPAGENAME in its TALKSPACE |
| {{SUBJECTPAGENAME}} {{SUBJECTPAGENAMEE}} |
Help:Magic words
|
[MW1.7+] FULLPAGENAME in its SUBJECTSPACE |
| {{ARTICLEPAGENAME}} {{ARTICLEPAGENAMEE}} |
Help:Magic words
|
[MW1.7+] An alias for SUBJECTPAGENAME(E) |
| {{REVISIONID}} | 2221
|
[MW1.5+] The unique identifying number of a page revision. |
| {{REVISIONDAY}} | 3
|
[MW1.8+] The day on which the page was last modified. |
| {{REVISIONDAY2}} | 03
|
[MW1.8+] The day on which the page was last modified, but with a leading zero (01 .. 31). |
| {{REVISIONMONTH}} | 01
|
[MW1.8+] The month in which the page was last modified. |
| {{REVISIONYEAR}} | 2007
|
[MW1.8+] The year in which the page was last modified. |
| {{REVISIONTIMESTAMP}} | 20070103195451
|
[MW1.8+] ISO 8601 time stamp, indicating when the page was last modified. |
| {{SITENAME}} | APBWiki
|
As given in config file. |
| {{SERVER}} | http://apbwiki.rpipepbandalumni.org | As given in config file. |
| {{SCRIPTPATH}} |
|
[MW1.5+] As given in config file. |
| {{SERVERNAME}} | apbwiki.rpipepbandalumni.org
|
[MW1.5+] As given in config file. |
Parser functions
- For details blah blah blah
Namespaces and URLs
| Word | Example | Explanation |
|---|---|---|
| {{ns:}} | {{ns:4}} = APBWiki{{ns:project}} = APBWiki
|
Returns the name of a given namespace number. |
| {{localurl:x y @}} {{localurle:x y @}} {{localurl:a|b=c}} |
/X_y_@
|
Returns the local URL of a page (might not exist). Optional query parameter. |
| {{urlencode:x y @}} | x+y+%40
|
[MW1.7+] Encodes variable values for use in external links. [3] |
| {{anchorencode:x #y @}} | x_.23y_.40
|
[MW1.8+] Encodes variable values for use in external links. [4] |
| {{fullurl:x y @}} {{fullurle:x y @}} {{fullurl:m:a|b=c}} |
http://apbwiki.rpipepbandalumni.org/X_y_@ http://apbwiki.rpipepbandalumni.org/X_y_@ http://apbwiki.rpipepbandalumni.org/index.php?title=M:a&b=c |
[MW1.5+] Returns the full URL of a given page. Optional query parameter as for localurl:. |
Formatting
| Word | Example | Explanation |
|---|---|---|
| {{#language:}} | {{#language:da}} = dansk
|
[MW1.7+] Native name of language code. |
| {{lc:}} | {{lc:AbC dEf}} = abc def
|
[MW1.5+] LowerCase |
| {{lcfirst:}} | {{lcfirst:Ab Cd}} = ab Cd
|
[MW1.5+] LC first char. |
| {{uc:}} | {{uc:aBc DeF}} = ABC DEF
|
[MW1.5+] UpperCase |
| {{ucfirst:}} | {{ucfirst:aB cD}} = AB cD
|
[MW1.5+] UC first char. |
| {{formatnum:}} | {{formatnum:-299792458.56789}} = -299,792,458.56789
|
[MW1.7+] Add decimal separators according to the wiki's default locale. Leading minus and plus are recognized. |
| {{padleft:}} {{padright:}} |
{{padleft:bcd|6|a}} = aaabcd{{padright:bcd|6|a}} = bcdaaa
|
[MW1.8+] Pads a string with a character to the specified width. |
Padding does not seem to work for characters with a multi-character code, such as , which would be useful with padleft for sorting tables with Javascript.
Template modifiers
| Usage | Explanation |
|---|---|
| {{:xyz}} | A bare colon is not a template modifier, it's the prefix for the main namespace. Test e.g. article {{:UTC}} vs. template {{UTC}}. Using this syntax you include the text of the main namespace article xyz in another article. |
| {{int:xyz}} | Shorthand for {{MediaWiki:xyz}}, rendered as ⧼xyz⧽ if [[MediaWiki:xyz]] doesn't exist. |
| {{msg:xyz}} | Try {{Template:xyz}} before magic word xyz, without this modifier it's the other way around. No additional effect if there is no template xyz. |
| {{msgnw:xyz}} | The unevaluated wikitext is rendered. Look up msgnw. |
| {{raw:xyz}} | [MW1.6+] Like {{msg:}} (unclear) [5]
|
| {{subst:xyz}} | In the wikitext, the tag is substituted by the content (single-level evaluation only). |
Image modifiers
- For details see w:en:Wikipedia:Extended image syntax.
These are image modifiers used in [[Image:title.ext|modifier|...|modifier]] links. Some are mutually exclusive, and then the last specified wins.
Size
The last unrecognized modifier is used as caption for framed images or together with thumbnails. It's also used as description alt=text.
| Word | Usage | Explanation |
|---|---|---|
| framed frame enframed |
[[Image:Mediawiki.png|framed]] | Places an image in a frame with a description. Uses original size. |
| thumbnail thumb |
[[Image:Mediawiki.png|thumbnail]] | Modifies image size, sets it to dependant on user's favourite thumbnail size in their preferences. |
| thumb=xyz | [[Image:Mediawiki.png|thumb=Wiki.png]] | Manualthumb: instead of displaying an automatically-sized thumbnail for Mediawiki.png, display the image Wiki.png. |
| width px | [[Image:Mediawiki.png|40px]] | Scales image to given width in pixels |
Position
The positions are mutually exclusive, the last specified wins. Template:- can stop floating. For inline images only modifier px (see above) is supported.
| Word | Usage | Explanation |
|---|---|---|
| right | [[Image:Mediawiki.png|right]] | Modifies position, floats the image to the right. |
| left | [[Image:Mediawiki.png|left]] | Modifies position, floats the image to the left. |
| none | [[Image:Mediawiki.png|none]] | Explicitly states that the image should not float. |
| center centre |
[[Image:Mediawiki.png|center]] | Modifies position, like none but centered. |
Miscellany
| Word | Example | Explanation |
|---|---|---|
| {{DISPLAYTITLE:xyz}} | default disabled | [MW 1.7+] Set the page's title [6], see AllowDisplayTitle. |
| {{DIRMARK}} {{DIRECTIONMARK}} |
|
[MW1.7+] u+200E left to right or u+200D right to left mark |
| {{CONTENTLANGUAGE}} | en
|
[MW1.7+] Default content LanguageCode |
| #redirect | #REDIRECT [[target]]at top of source page |
Creates a redirect to another page. |
Language-dependent word conversions
| Word | Example | Explanation |
|---|---|---|
| {{ CURRENTMONTHNAMEGEN }} | December
|
Genitive form of month name used for Czech, Polish, Ukrainian[7] |
| {{grammar:case | word }} | {{grammar:7sg|Wikipedie}} on cs is Wikipedií.
|
Derived word forms in inflected languages like Czech [8] |
| {{plural:count |form1 |form2 }} {{plural:count |1st | 2nd | 3rd }} |
{{plural: 2 | is | are }} outputs are{{plural: 0 | this | these }} outputs these
|
count 1 yields form1 (singular), plural transformations are used for languages like Russian [9] based on "count mod 10". |
"Grammar" and "Plural" are language-dependent functions, defined in [10], [11], etc. (note that in PHP, the modulo operator is the percent sign).
"Grammar" can either be applied to predefined words only, or to arbitrary words, depending on whether the definition is just a 2D array, or involves string manipulations.
"Plural" is a project-dependent switch function, e.g. giving the first text if count = 1, the second if count = 2,3, or 4, and else the third. See also mediazilla:5805 for the use of "plural" in system messages.
See also
- Parser functions #expr:, #if:, #ifeq:, etc.
- Source for Language.php
- Source for MagicWord.php