सहाय्य:चर
A variable can be considered a predefined template without parameters. See also Help:Parser function.
This is a list of variables that can be used in the wikitext. The way they are rendered vary with time (directly depending on time, or e.g. for number of articles, depending on the creation of other articles), on the project (it changes when the wikitext is copied), or on the page in which it occurs (it changes when the wikitext is copied, when the page is renamed, and when the page is included in another page).
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 "जादुई शब्द" the system uses.
With Special:ExpandTemplates one can view the value of a variable, or more generally, the expanded wikitext a variable or a wikitext with variables and/or template calls produces, as intermediate step toward rendering.
Constants
संपादन{{SITENAME}}
|
विकिपीडिया | |
{{SERVER}}
|
//mr.wikipedia.org | |
{{SERVERNAME}}
|
mr.wikipedia.org | |
{{CONTENTLANGUAGE}}
|
mr | code of the site's default interface language (साचा:H:mwg) |
Depending on page
संपादनWord | Example | Explanation | |
---|---|---|---|
This page | "User:Anonymous user/sandbox/my page " page
| ||
"User talk:Anonymous user/sandbox/my page " page
| |||
{{PAGENAME}} | चर
|
Anonymous user/sandbox/my page
|
Returns the name of the current page, including all levels (Title/Subtitle). This does not include the name of the namespace. |
{{PAGENAMEE}} | %E0%A4%9A%E0%A4%B0
|
Anonymous_user/sandbox/my_page
|
More URL-friendly percent encoded special characters (To use an articlename in an external link). |
{{BASEPAGENAME}} {{BASEPAGENAMEE}} |
चर
|
Anonymous user/sandbox
|
[MW1.7+] The basename of a subpage ("Title/Other" on "Title/Other/Subtitle"), see Help:Link. |
{{SUBPAGENAME}} {{SUBPAGENAMEE}} |
चर
|
my page
|
[MW1.6+] Name of the current page, excluding parent pages ("Subtitle" on "Title/Other/Subtitle") in namespaces supporting subpages, see Help:Link. |
{{NAMESPACE}} {{NAMESPACEE}} |
सहाय्य
|
User
|
Returns the name of the namespace the current page resides in. |
User talk
| |||
{{FULLPAGENAME}} {{FULLPAGENAMEE}} |
सहाय्य:चर
|
User:Anonymous user/sandbox/my page
|
[MW1.6+] Shorthands for NAMESPACE+PAGENAME |
User talk:Anonymous user/sandbox/my page
| |||
{{TALKSPACE}} {{TALKSPACEE}} |
सहाय्य चर्चा
|
User talk
|
[MW1.7+] Name of next odd namespace (e.g. 4 => 5) |
{{SUBJECTSPACE}} {{SUBJECTSPACEE}} |
सहाय्य
|
User
|
[MW1.7+] Name of last even namespace (e.g. 5 => 4) |
{{ARTICLESPACE}} {{ARTICLESPACEE}} |
सहाय्य
|
User
|
[MW1.7+] An alias for SUBJECTSPACE(E) |
{{TALKPAGENAME}} {{TALKPAGENAMEE}} |
सहाय्य चर्चा:चर
|
User talk:Anonymous user/sandbox/my page
|
[MW1.7+] FULLPAGENAME in its TALKSPACE |
{{SUBJECTPAGENAME}} {{SUBJECTPAGENAMEE}} |
सहाय्य:चर
|
User:Anonymous user/sandbox/my page
|
[MW1.7+] FULLPAGENAME in its SUBJECTSPACE |
{{ARTICLEPAGENAME}} {{ARTICLEPAGENAMEE}} |
सहाय्य:चर
|
User:Anonymous user/sandbox/my page
|
[MW1.7+] An alias for SUBJECTPAGENAME(E) |
{{REVISIONID}} | -
|
N/A | [MW1.5+] The unique identifying number of a page, see Help:Diff. Note that when editing a page, this value is null. |
{{REVISIONDAY}} | 15
|
N/A | [MW1.8+] The day on which the page was last modified. |
{{REVISIONDAY2}} | 15
|
N/A | [MW1.8+] The day on which the page was last modified, but with a leading zero (01 .. 31). |
{{REVISIONMONTH}} | 10
|
N/A | [MW1.8+] The month in which the page was last modified. |
{{REVISIONYEAR}} | 2018
|
N/A | [MW1.8+] The year in which the page was last modified. |
{{REVISIONTIMESTAMP}} | 20181015102030
|
N/A | [MW1.8+] ISO 8601 time stamp, indicating when the page was last modified. |
{{SITENAME}} | विकिपीडिया
|
Value of साचा:H:mwg. | |
{{SERVER}} | //mr.wikipedia.org | Value of साचा:H:mwg | |
{{SCRIPTPATH}} | /w
|
[MW1.5+] साचा:H:mwg | |
{{SERVERNAME}} | mr.wikipedia.org
|
[MW1.5+] साचा:H:mwg |
For the rendering on page A, these variables depend on page A, even if page A contains the variable due to inclusion of page B. Variables in the sort key of a category tag refer to the page with the tag, not the category page where it takes effect.
{{NAMESPACE}} and {{NAMESPACEE}} return an empty string in the article namespace {{ns:0}}, see above and NS:0.
PAGENAMEE displays the page title in the form that is used in URLs, i.e. with underscores for spaces, and percent-encoding for special characters, and is therefore used for constructing URLs incl. query strings.
For example, on Template talk:!, SUBJECTPAGENAMEE would produce Template:%21. Don't encode PAGENAMEE etc. again, i.e. don't use it in the first parameter of fullurl: and similar parser functions, {{urlencode:%21}} = %2521 probably won't work as expected. Query strings in PURL redirections are an exception.
The "EE" encoding examples shown above for this page are not very interesting, only TALKPAGENAMEE and TALKSPACEE differ from TALKPAGENAME and TALKSPACE. See Help:Link and Help:Magic words for other examples.
In a subpage, [[../]] renders as a link to the parent page. For example, on m:Link/a/b it gives an internal link to m:Link/a, see Help:Link#Subpage feature.
साचा:Xpdoc showing the current unique revision number of a saved page as used for diffs in the page history is in essence useless, it can't be substituted and also doesn't work in preview.
Varying with time
संपादनTime
संपादनThe time in UTC. Note that if the page was displayed by the same user and has not changed (page has not been edited) since the last time it was displayed, it is possible that the page may be cached (by the user's browser) and the displayed time or date may not change. Also, if a heavily used page, rather than freshly rendered by the software each time it is generated, is instead being retrieved from a caching system (such as the main page on Wikipedia) the date or time may not change from the last time the page was originally retrieved by the caching hardware or software. साचा:H:Current time variables
Local time
संपादनLocal time depends on the local timezone of the wiki, not the time zone in the user preferences. These should generally use {{#time:}} if ParserFunctions are installed, but the following legacy variables are also available from MediaWiki 1.8+.
Because of the way MediaWiki and most browsers cache HTML pages, time variables which change more often than once a day will typically show the time the page was last cached, rather than the current time.
Statistics
संपादनSee Statistics.
Substitution
संपादन- Main article: Help:Substitution
When {{<includeonly>subst:</includeonly>CURRENTTIMESTAMP}}
is included and thereby substituted, the timestamp of doing that is put in the wikitext, and similarly for other variables. Examples:
{{CURRENTTIMESTAMP}}
- 20241222105235 - stays a variable on pages including the template
{{subst:CURRENTTIMESTAMP}}
- 20060526024210 - became a substituted constant in the template
{{<includeonly>subst:</includeonly>CURRENTTIMESTAMP}}
- 20241222105235 - becomes a constant at the time of its inclusion
Templates with the "includeonly subst magic" must also be subst-ed.
Other
संपादनWord | Example | Example results | Explanation |
---|---|---|---|
{{PAGESINCATEGORY:category}} {{PAGESINCATEGORY:category|R}} |
{{PAGESINCATEGORY:User en}} {{PAGESINCATEGORY:User en|R}}
|
८७ 87
|
[MW1.13+] Returns the number of pages in a given category. |
{{PAGESINCAT:category}} {{PAGESINCAT:category|R}} |
{{PAGESINCAT:User en}} {{PAGESINCAT:User en|R}}
|
८७ 87
|
[MW1.13+] Alias of PAGESINCATEGORY. |
Examples of combinations with parser functions
संपादन{{fullurl:{{FULLPAGENAME}}|action=edit}}
- //mr.wikipedia.org/w/index.php?title=%E0%A4%B8%E0%A4%B9%E0%A4%BE%E0%A4%AF%E0%A5%8D%E0%A4%AF:%E0%A4%9A%E0%A4%B0&action=edit
{{fullurl:w:en:Special:Whatlinkshere|target={{NAMESPACE}}:Contents}}
- https://en.wikipedia.org/wiki/en:Special:Whatlinkshere?target=सहाय्य:Contents
{{fullurl:m:Special:Whatlinkshere|target={{FULLPAGENAME}}}}
- https://meta.wikimedia.org/wiki/Special:Whatlinkshere?target=सहाय्य:चर
[[{{NAMESPACE}} talk:{{PAGENAME}}]]
- सहाय्य talk:चर
{{fullurl:{{NAMESPACE}} talk:{{PAGENAME}}}}
- //mr.wikipedia.org/wiki/%E0%A4%B8%E0%A4%B9%E0%A4%BE%E0%A4%AF%E0%A5%8D%E0%A4%AF_talk:%E0%A4%9A%E0%A4%B0
The old form {{SERVER}}{{localurl:
page }}
does not always work:
{{SERVER}}{{localurl:Wikipedia:Category
}}
gives //mr.wikipedia.org/wiki/%E0%A4%B5%E0%A4%BF%E0%A4%95%E0%A4%BF%E0%A4%AA%E0%A5%80%E0%A4%A1%E0%A4%BF%E0%A4%AF%E0%A4%BE:Category
Apart from those problems it is in essence the same as
{{fullurl:
page }}
in recent (1.5+) versions of the software.
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.
Variable in the form of a template call
संपादनIf the syntax of a template call with parameters is applied with the name of a variable, depending on the variable the parameters are either ignored or cause the variable to be interpreted as a (non-existing) template:
- Variables like {{NUMBEROFPAGES:R}} = 318800 with a "raw" format are always handled as variable, {{NUMBEROFPAGES:R|Para|meter}} = 318800.
- Other variables like {{CURRENTDAYNAME}} = रविवार are handled as template for given parameter(s), {{CURRENTDAYNAME|x}} = साचा:CURRENTDAYNAME.
- Parser functions like {{lc: Lower Case}} = lower case ignore extraneous parameters, {{lc: Lower|Case}} = lower.
- Parser function ns (e.g. {{ns: 1}} = चर्चा) gives an empty string for a non-applicable numerical parameter value, and evaluates in the case of a non-numerical parameter value as template (the template name being the whole text until "|" or "}}"):
- {{ns: 1234}} =
- {{ns: t|abc}} = साचा:Ns: t
- Parser functions like fullurl don't support the ../ notation, and in namespaces supporting subpages this has odd effects: like above, they evaluate such an invalid parameter value as template, see Link/a and Link/a/b. Here it just renders the wikitext:
- {{fullurl:../a}} = साचा:Fullurl:../a.
- The cases #2, #4, and #5 resulting in template calls are probably related.
See also
संपादन- Help:Parser function: a way of integrating with the parser more tightly since version 1.7.0
- Adding parser functions
- The ParserFunctions extension (#expr:, #if:, #ifeq:, etc.; #titleparts:)
- Help:Substitution: on applying "subst" to a variable or to a template using a variable
- mw:Manual:Magic words
- mw:Extension:Variables: adding new magic words like {{CURRENTUSER}}
- MagicWord.php