Difference between revisions of "Help:Variables"
(variables in templates) |
m |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | A '''variable''' is called in the form of a [[Help:Template|template]] | + | A '''variable''' is called in the form of a [[Help:Template|template]]. Variables often refer to specific aspects of the respective page or the wiki, or to time and date variables. |
{| class= "wikitable" style="border:1px black solid" | {| class= "wikitable" style="border:1px black solid" | ||
Line 17: | Line 17: | ||
! | ! | ||
|- | |- | ||
− | | | + | | Page Info || || |
|- | |- | ||
| <tt><nowiki>{{PAGENAME}}</nowiki></tt> || {{PAGENAME}} || Displays name of page (without namespace) | | <tt><nowiki>{{PAGENAME}}</nowiki></tt> || {{PAGENAME}} || Displays name of page (without namespace) | ||
Line 29: | Line 29: | ||
<nowiki>{{TEMPLATENAME | VARNAME = VALUE }}</nowiki> | <nowiki>{{TEMPLATENAME | VARNAME = VALUE }}</nowiki> | ||
which replaces the variable with VALUE. Note that if you name the variables <nowiki>{{{1}}},{{{2}}},{{{3}}}</nowiki>, etc. then you can specify the values without listing the variable names in the template call. | which replaces the variable with VALUE. Note that if you name the variables <nowiki>{{{1}}},{{{2}}},{{{3}}}</nowiki>, etc. then you can specify the values without listing the variable names in the template call. | ||
− | == See | + | == See Also == |
− | |||
− | [ | + | * [//meta.wikimedia.org/wiki/Help:Variable MetaWiki] |
− | {{ | + | |
+ | {{tutorial}} |
Latest revision as of 12:35, 24 March 2025
A variable is called in the form of a template. Variables often refer to specific aspects of the respective page or the wiki, or to time and date variables.
Date | |||
{{CURRENTDAY}} | 7 | Displays day | |
{{CURRENTYEAR}} | 2025 | Displays year | |
{{CURRENTMONTHNAME}} | May | Displays month | |
{{CURRENTTIME}} | 17:01 | Displays time | |
{{CURRENTHOUR}} | 17 | Displays hour | |
Page Info | |||
{{PAGENAME}} | Variables | Displays name of page (without namespace) | |
{{PAGENAMEE}} | Variables | Same as PAGENAME, but formatted for an URL. |
Also, in templates, you can specify a variable in it with {{{VARNAME}}}.
Then, when the template is put onto another page, you can specify the variable as follows:
{{TEMPLATENAME | VARNAME = VALUE }}
which replaces the variable with VALUE. Note that if you name the variables {{{1}}},{{{2}}},{{{3}}}, etc. then you can specify the values without listing the variable names in the template call.
See Also
This article is a tutorial about the AoPSWiki or AoPS Forum.