From NuGOwiki
This is a list of variables that can be used in the wikitext. The way they are rendered depends on the time, on the project, or on the page in which it occurs.
On the left is the variable, on the right how it is rendered at this time, in this project, on this page.
The names of the variables form part of the set of so-called "magic words" the system uses. [1]
Contents |
Constant, only depending on the project and parameters
| {{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}} | NuGOwiki |
| {{ns:5}} or {{ns:Project_talk}} | NuGOwiki 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 |
| depending on custom namespaces: {{ns:100}}, {{ns:101}}, etc. | , , etc. |
| {{SITENAME}} | NuGOwiki |
| {{SERVER}} | http://www.nugowiki.org |
| {{SERVERNAME}} | www.nugowiki.org |
| {{localurl:pagename}} | /index.php/Pagename |
| {{localurle:pagename}} | /index.php/Pagename |
| {{localurl:pagename|query string}} | /index.php?title=Pagename&query string |
| {{int:fromwikipedia}} | <fromwikipedia> |
The variable localurl replaces spaces by underscores and special characters by escape codes, e.g. {{localurl:a �}} gives {{localurl:a �}}. The purposes are:
- for a given page name, creating a link in external link style to a page in the same project or a project which uses the same string in the URL between the server name and the page name (on Wikimedia "/wiki/" and "w/index.php?title=").
- allow the same wikitext to be used in a project that uses a different string, if the target is in that other project or a project which uses the same string
Note that localurl does not convert page names and user names after "target=". This syntax can be avoided by putting the target in the first part of localurl, after the "/":
The {{fullurl}} variable introduced in recent versions allows the entire link to be specified in one go, without also using {{server}}. This also means it can be used in the same way for local and interwiki links (it being clearly inappropriate to add {{server}} before the latter)
Varying with time
| {{CURRENTMONTH}} | 02 | --Two-digit month number. |
| {{CURRENTMONTHNAME}} | February | |
| {{CURRENTMONTHABBREV}} | Feb | |
| {{CURRENTMONTHNAMEGEN}} | February | |
| {{CURRENTWEEK}} | 6 | |
| {{CURRENTDAY}} | 8 | --One digit when day is below 10. |
| {{CURRENTDAYNAME}} | Wednesday | |
| {{CURRENTDOW}} | 3 | --One-digit day of the week; 0=Sunday, 1=Monday ... 6=Saturday |
| {{CURRENTYEAR}} | 2012 | |
| {{CURRENTTIME}} | 15:52 | |
| {{NUMBEROFARTICLES}} | 8,943 | |
| {{NUMBEROFFILES}} | 996 |
NUMBEROFARTICLES: number of pages in the main namespace which contain a link and are not a redirect, i.e. number of articles, stubs containing a link, and disambiguation pages.
This depends on system variable $wgUseCommaCount If true, article count will only include those with commas (","). If false, will only count those with links ("[["). The default set in DefaultSettings.php is false, this can be changed in LocalSettings.php.
Subst
When a template containing {{<includeonly>subst:</includeonly>CURRENTDAY}} is subst'ed, the day of doing that is put in the wikitext, and similarly for other variables.
Depending on page
| {{NAMESPACE}} | Help |
| {{PAGENAME}} | Variable |
When used in a template, these three variables refer to the page in which the template is included, not to the template page.
Subst
When a template containing {{<includeonly>subst:</includeonly>PAGENAME}} is subst'ed in a page, the name of the latter page is put in the wikitext, and similarly for other variables.
Depending on revision
{{REVISIONID}} gives 2194
REVISIONID displays a unique number identifying a version of a page in the set of all versions of all pages. In the URL the number can be referred to as "oldid=..", even when the version is still the current one. This can be useful on talk pages, and for citation in newspaper, scholar works, etc. When applying such a URL, at the top of the page the date and local time (if not logged in: UTC) are displayed, with a link to the previous version, and a link to the next version (unless at the time of loading the page there is no newer version: in that case the text "Newer revision" appears anyway, but it is not a link; if the version is the first, a link labeled "previous revision" appears anyway, but it leads to the same page)
The page history page also uses such a URL.
In a preview, the REVISIONID is not defined.
Examples of combinations
| {{SERVER}}{{localurl:Special:Whatlinkshere|target={{NAMESPACE}}:{{PAGENAME}}}} | http://www.nugowiki.org/index.php?title=Special:Whatlinkshere&target=Help:Variable |
| {{SERVER}}{{localurl:{{NAMESPACE}}:{{PAGENAME}}|action=edit}} | http://www.nugowiki.org/index.php?title=Help:Variable&action=edit |
| {{SERVER}}{{localurl:Special:Whatlinkshere|target={{NAMESPACE}}:{{PAGENAME}}}} | http://www.nugowiki.org/index.php?title=Special:Whatlinkshere&target=Help:Variable |
| [[{{NAMESPACE}}:{{PAGENAME}}_1]] | Help:Variable_1 |
| {{SERVER}}{{localurl:{{NAMESPACE}}:{{PAGENAME}}_1}} | http://www.nugowiki.org/index.php/Help:Variable_1 |
| {{SERVER}}{{localurl:{{NAMESPACE}}:{{PAGENAME}}|oldid={{REVISIONID}}}} | http://www.nugowiki.org/index.php?title=Help:Variable&oldid=2194 |
[Note that {{SERVER}}{{localurl... can be replaced by {{fullurl... in recent (>1.5.5) versions of the software.]
As a link the last example is not useful in the page itself, but it gives useful info about the original in a paper or HTML copy of the page, and provides a link to that in the HTML copy. Also the rendered URL can be copied to the wikitext of this or another page, to refer to the version at the time of copying, e.g. http://meta.wikimedia.org/w/index.php?title=Help:Variable&oldid=178844 (For the latter purpose one can also use the link targets on the page history page).
In a template, for a link to a page which depends on a template parameter, the external link style is used even for internal links, to avoid that the system links to the edit page even if the page exists. To construct the external link, variables can also be useful.
Variables in links
Variables work also in links:
- [[a{{NAMESPACE}}b|c{{PAGENAME}}d]] gives cVariabled