Template:PAGENAME/doc:修订间差异
无编辑摘要 标签:2017年版源代码编辑 |
→参见: // Edit via Wikiplus 标签:Wikiplus |
||
(未显示2个用户的2个中间版本) | |||
第1行: | 第1行: | ||
{{NoteTA|G1=MediaWiki}}{{Documentation subpage}}<!-- 在本行下編輯模板說明 -->{{ |
{{NoteTA|G1=MediaWiki}}{{Documentation subpage}}<!-- 在本行下編輯模板說明 -->{{important|请使用'''<nowiki>{{PAGENAME:页面名}}</nowiki>'''而不是<nowiki>{{PAGENAME|页面名}}</nowiki>,中间是一个半角冒号“:”,不是管道符号“|”,这样即可直接调用[[Help:魔术字|魔术字]]而不需要通过该模版间接调用。}} |
||
== |
== 使用方法 == |
||
{{important|Please use '''<nowiki>{{PAGENAME:page name}}</nowiki> '''rather than <nowiki>{{PAGENAME|page name}}</nowiki>, with a colon (":"), not a pipe symbol ("|"). This uses the [[m:magic word|magic word]] directly instead of using the template to call the magic word.}} |
|||
<nowiki>{{PAGENAME}}</nowiki> is not actually a template, but instead is a [[WP:Magic words|magic word]], meaning it is a feature of the MediaWiki software. When used, it will return the name of the page it's on, but without the namespace. As an example, when placed on this page, it returns {{PAGENAME}}. When placed on [[Wikipedia:Village pump]], it will return {{PAGENAME:Wikipedia:Village pump}}. It is possible to specify which pagename will appear by using a colon (not a pipe as is typical for templates). As an example, <nowiki>{{PAGENAME:Wikipedia:Village pump}}</nowiki> returns {{PAGENAME:Wikipedia:Village pump}}. |
|||
== 參數及使用方法 == |
|||
There is actual template code here. The purpose of the template code is to ensure that if someone uses this [[Wikipedia:Magic words#Variables|magic word]] with a piped parameter, the template code will be invoked and it will not cause an error on the page. Parameter 1 will be used as the : parameter and other parameters will be discarded. This way, if someone mistakenly enters <nowiki>{{PAGENAME|Wikipedia:Village pump}}</nowiki>, the template will change it to the correct <nowiki>{{PAGENAME:Wikipedia:Village pump}}</nowiki> |
|||
When a user mistakenly includes a pipe in a <nowiki>{{PAGENAME}}</nowiki> call, the template code will add the page to the hidden category [[:Category:Pages which use a template in place of a magic word]]. Pages in this category should be fixed by willing editors. |
|||
== 範例 == |
== 範例 == |
||
第14行: | 第19行: | ||
== 參見 == |
== 參見 == |
||
* [[mw:Help:Magic words#Page names|List of page name magic words]] (MediaWiki帮助) |
|||
* {{tl|Page}} |
|||
* {{tl|Name}} |
|||
* {{tl|PAGENAMEBASE}} (可以从标题中去除括号)<!-- variant to strip anything in parentheses from the title --> |
|||
* {{tl|FULLPAGENAME}} (包括命名空间<!-- includes the namespace -->) |
|||
<includeonly>[[Category:魔術字模板|{{PAGENAME}}]]</includeonly> |
<includeonly>[[Category:魔術字模板|{{PAGENAME}}]]</includeonly> |
2024年5月7日 (二) 07:12的最新版本
此頁面是Template:PAGENAME的Template文档。 此頁面可能包含了模板的使用說明、分類和其他内容。 |
请使用{{PAGENAME:页面名}}而不是{{PAGENAME|页面名}},中间是一个半角冒号“:”,不是管道符号“|”,这样即可直接调用魔术字而不需要通过该模版间接调用。 |
使用方法
[编辑]Please use {{PAGENAME:page name}} rather than {{PAGENAME|page name}}, with a colon (":"), not a pipe symbol ("|"). This uses the magic word directly instead of using the template to call the magic word. |
{{PAGENAME}} is not actually a template, but instead is a magic word, meaning it is a feature of the MediaWiki software. When used, it will return the name of the page it's on, but without the namespace. As an example, when placed on this page, it returns PAGENAME/doc. When placed on Wikipedia:Village pump, it will return Village pump. It is possible to specify which pagename will appear by using a colon (not a pipe as is typical for templates). As an example, {{PAGENAME:Wikipedia:Village pump}} returns Village pump.
There is actual template code here. The purpose of the template code is to ensure that if someone uses this magic word with a piped parameter, the template code will be invoked and it will not cause an error on the page. Parameter 1 will be used as the : parameter and other parameters will be discarded. This way, if someone mistakenly enters {{PAGENAME|Wikipedia:Village pump}}, the template will change it to the correct {{PAGENAME:Wikipedia:Village pump}}
When a user mistakenly includes a pipe in a {{PAGENAME}} call, the template code will add the page to the hidden category Category:Pages which use a template in place of a magic word. Pages in this category should be fixed by willing editors.
範例
[编辑]重定向
[编辑]注意事项
[编辑]模板编辑说明
[编辑]參見
[编辑]- List of page name magic words (MediaWiki帮助)
- {{Page}}
- {{Name}}
- {{PAGENAMEBASE}} (可以从标题中去除括号)
- {{FULLPAGENAME}} (包括命名空间)