Actions

Help

Difference between revisions of "Variable"

From Sonic Retro

m (+cat)
(Redirected page to cdn:Help:Variable)
 
Line 1: Line 1:
'''← [[Help: Contents]]'''
+
#REDIRECT [[cdn:Help:Variable]]
 
 
This page presents a list of '''variables''' that can be used in the wikitext.  Similar to [[Help:template|template]]s, their content is dynamically included in the page text.  Unlike templates, however, a variable's rendering depends on the time, the project, or the page on which it appears.
 
 
 
=="Constant" variables==
 
These variables are mainly useful in the event that Sonic Retro content is included in some other MediaWiki-based database.
 
 
 
{| class="grey" width="60%"
 
|-
 
| <nowiki>{{ns:-2}} or {{ns:Media}}</nowiki>
 
| {{ns:-2}}
 
|-
 
| <nowiki>{{ns:-1}} or {{ns:Special}}</nowiki>
 
| {{ns:-1}}
 
|-
 
| <nowiki>{{ns:1}} or {{ns:Talk}}</nowiki>
 
| {{ns:1}}
 
|-
 
| <nowiki>{{ns:2}} or {{ns:User}}</nowiki>
 
| {{ns:2}}
 
|-
 
| <nowiki>{{ns:3}} or {{ns:User_talk}}</nowiki>
 
| {{ns:3}}
 
|-
 
| <nowiki>{{ns:4}} or {{ns:Project}}</nowiki>
 
| {{ns:4}}
 
|-
 
| <nowiki>{{ns:5}} or {{ns:Project_talk}}</nowiki>
 
| {{ns:5}}
 
|-
 
| <nowiki>{{ns:6}} or {{ns:Image}}</nowiki>
 
| {{ns:6}}
 
|-
 
| <nowiki>{{ns:7}} or {{ns:Image_talk}}</nowiki>
 
| {{ns:7}}
 
|-
 
| <nowiki>{{ns:8}} or {{ns:MediaWiki}}</nowiki>
 
| {{ns:8}}
 
|-
 
| <nowiki>{{ns:9}} or {{ns:MediaWiki_talk}}</nowiki>
 
| {{ns:9}}
 
|-
 
| <nowiki>{{ns:10}} or {{ns:Template}}</nowiki>
 
| {{ns:10}}
 
|-
 
| <nowiki>{{ns:11}} or {{ns:Template_talk}}</nowiki>
 
| {{ns:11}}
 
|-
 
| <nowiki>{{ns:12}} or {{ns:Help}}</nowiki>
 
| {{ns:12}}
 
|-
 
| <nowiki>{{ns:13}} or {{ns:Help_talk}}</nowiki>
 
| {{ns:13}}
 
|-
 
| <nowiki>{{ns:14}} or {{ns:Category}}</nowiki>
 
| {{ns:14}}
 
|-
 
| <nowiki>{{ns:15}} or {{ns:Category_talk}}</nowiki>
 
| {{ns:15}}
 
|-
 
| <nowiki>{{SITENAME}}</nowiki>
 
| {{SITENAME}}
 
|-
 
| <nowiki>{{SERVER}}</nowiki>
 
| {{SERVER}}
 
|-
 
| <nowiki>{{localurl:pagename}}</nowiki>
 
| {{localurl:pagename}}
 
|-
 
| <nowiki>{{localurl:pagename|</nowiki>''query string''<nowiki>}}</nowiki>
 
| {{localurl:pagename|''query string''}}
 
|}
 
 
 
==Time-based variables==
 
 
 
{| class="grey" width="60%"
 
|-
 
| <nowiki>{{CURRENTMONTH}}</nowiki>
 
| {{CURRENTMONTH}}
 
|-
 
| <nowiki>{{CURRENTMONTHNAME}}</nowiki>
 
| {{CURRENTMONTHNAME}}
 
|-
 
| <nowiki>{{CURRENTMONTHNAMEGEN}}</nowiki>
 
| {{CURRENTMONTHNAMEGEN}}
 
|-
 
| <nowiki>{{CURRENTDAY}}</nowiki>
 
| {{CURRENTDAY}}
 
|-
 
| <nowiki>{{CURRENTDAYNAME}}</nowiki>
 
| {{CURRENTDAYNAME}}
 
|-
 
| <nowiki>{{CURRENTYEAR}}</nowiki>
 
| {{CURRENTYEAR}}
 
|-
 
| <nowiki>{{CURRENTTIME}}</nowiki>
 
| {{CURRENTTIME}}
 
|-
 
| <nowiki>{{NUMBEROFARTICLES}}</nowiki>
 
| {{NUMBEROFARTICLES}}
 
|}
 
 
 
The NUMBEROFARTICLES variable is defined as the number of articles in the main [[Help:namespace|namespace]] that contain a link to another page and are not a redirect.  In other words, the number of articles, stubs containing a link, and disambiguation pages.
 
 
 
==Page-based variables==
 
 
 
{| class="grey" width="60%"
 
| <nowiki>{{NAMESPACE}}</nowiki>
 
| {{NAMESPACE}}
 
|-
 
| <nowiki>{{PAGENAME}}</nowiki>
 
| {{PAGENAME}}
 
|-
 
| <nowiki>{{PAGENAMEE}}</nowiki>
 
| {{PAGENAMEE}}
 
|}
 
 
 
PAGENAMEE will display the page title in the style that is used in URLs — that is, with underscores for spaces and escape codes for special characters. For example, a page called "Test page" would render as "Test_page" instead.
 
 
 
When used in a [[Help:template|template]], these three variables refer to the page in which the template is included, not to the template page.
 
 
 
==Examples of combinations==
 
 
 
; <nowiki>{{SERVER}}{{localurl:{{NAMESPACE}}:{{PAGENAMEE}}|</nowiki>action=edit<nowiki>}}</nowiki> : {{SERVER}}{{localurl:{{NAMESPACE}}:{{PAGENAMEE}}|action=edit}}
 
; <nowiki>{{SERVER}}{{localurl:Special:Whatlinkshere|target={{NAMESPACE}}:{{PAGENAMEE}}}}</nowiki> : {{SERVER}}{{localurl:Special:Whatlinkshere|target={{NAMESPACE}}:{{PAGENAMEE}}}}
 
; <nowiki>[[{{NAMESPACE}}:{{PAGENAMEE}}/temp]]</nowiki> : [[{{NAMESPACE}}:{{PAGENAMEE}}/temp]]
 
; <nowiki>{{SERVER}}{{localurl:{{NAMESPACE}}:{{PAGENAMEE}}/temp}}</nowiki> : {{SERVER}}{{localurl:{{NAMESPACE}}:{{PAGENAMEE}}/temp}}
 
 
 
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.
 
 
 
[[Category:Help|Variable]]
 

Latest revision as of 17:22, 13 March 2018

Redirect to: