跳转到内容

Template:Talk other/doc:修订间差异

维基百科,自由的百科全书
删除的内容 添加的内容
RalfX留言 | 贡献
建立内容为“<includeonly><!-- 在這裡加入模板的保護標識 --></includeonly> {{Documentation subpage}} <!-- 在本行下編輯模板說明 --> This is the...”的新頁面
 
Tjmj留言 | 贡献
移至子分類
 
(未显示5个用户的15个中间版本)
第1行: 第1行:
<includeonly><!-- 在這裡加入模板的保護標識 --></includeonly>
{{Documentation subpage}}
{{Documentation subpage}}
<!-- 在本行下編輯模板說明 -->
<!-- 在本行下編輯模板說明 -->
第9行: 第8行:
=== 用法 ===
=== 用法 ===


這模板包含兩個參數,像這樣:
This template usually takes two parameters, like this:


<pre>{{talk other |討論頁產生文字|其他頁產生文字}}</pre>
<pre>
{{talk other | Talk pages text | Other pages text }}
</pre>


如果把這模板放在討論頁上,模板返回:
If the template is on any talk page, it will return this:


:{{talk other | demospace=talk | Talk pages text | Other pages text }}
:{{talk other | demospace=talk |討論頁產生文字|其他頁產生文字}}


如果把這模板放在其他頁面上,模板返回:
If the template is on any other page, it will return this:


:{{talk other | Talk page text | Other pages text }}
:{{talk other |討論頁產生文字|其他頁產生文字}}


A typical usage case could be to make it so that a template only adds a category when on talk pages. Thus not adding other pages that just show the template. Like this:
A typical usage case could be to make it so that a template only adds a category when on talk pages. Thus not adding other pages that just show the template. Like this:
第39行: 第36行:
=== Demospace ===
=== Demospace ===


為進行測試和示範,這模板有一個參數名為'''demospace'''。
For testing and demonstration purposes this template can take a parameter named '''demospace'''.


* 如果值為'''talk''',則返回討論頁產生文字。
* If it has the value '''talk''' it returns the talk pages text.
* 如果值為'''other'''或其他值,則返回其他頁產生文字。
* It if has the value '''other''' or any other value such as the name of some other namespace it returns the other pages text.
* 如果參數為空或未被定義,頁面決定結果。
* If the parameter is empty or undefined, the actual page type determines the result.


像這樣:
Like this:


<pre>
<pre>
{{talk other
{{talk other
|討論頁產生文字
| Talk pages text
|其他頁產生文字
| Other pages text
| demospace = talk
|demospace = talk
}}
}}
</pre>
</pre>


無論在什麼頁面都會返回:
No matter on what kind of page the code above is used it will return this:


:{{talk other
:{{talk other
|討論頁產生文字
| Talk pages text
|其他頁產生文字
| Other pages text
| demospace = talk
|demospace = talk
}}
}}


第83行: 第80行:
{{namespace detect see also}}
{{namespace detect see also}}


<includeonly>
<includeonly>{{sandbox other||
[[Category:命名空間操作模板]]
<!-- 本行下加入模板的分類 -->
[[Category:維基百科元模板]]
[[Category:討論頁模板]]
}}</includeonly>

<!-- 本行下加入模板的跨語言鏈接 -->
[[en:Template:Talk other]]
[[ja:Template:Talk other]]
</includeonly>

2021年10月16日 (六) 07:05的最新版本

This is the {{talk other}} meta-template.

This template helps other templates detect if they are on a talk page or some "other" type of page.

用法[编辑]

這模板包含兩個參數,像這樣:

{{talk other |討論頁產生文字|其他頁產生文字}}

如果把這模板放在討論頁上,模板返回:

討論頁產生文字

如果把這模板放在其他頁面上,模板返回:

其他頁產生文字

A typical usage case could be to make it so that a template only adds a category when on talk pages. Thus not adding other pages that just show the template. Like this:

{{talk other | [[Category:Some talk page category]] }}

Or to warn that a template should not be used on other pages:

{{talk other | | This template should only be used on talk pages. }}

Note that in the first case above the "other" parameter was not used, and in the second example the "talk" parameter was left empty.

Demospace[编辑]

為進行測試和示範,這模板有一個參數名為demospace

  • 如果值為talk,則返回討論頁產生文字。
  • 如果值為other或其他值,則返回其他頁產生文字。
  • 如果參數為空或未被定義,頁面決定結果。

像這樣:

{{talk other 
|討論頁產生文字
|其他頁產生文字
|demospace = talk
}}

無論在什麼頁面都會返回:

討論頁產生文字

You can make it so your template also understands the demospace parameter. That means you can demonstrate the different appearances of your template in the documentation for your template. Then do like this:

{{talk other 
| Talk pages text 
| Other pages text 
| demospace = {{{demospace|}}}
}}

Technical details[编辑]

This template detects all types of talk pages as type talk. That is, "Talk:", "User talk:", "File talk:" and so on are all of type talk.

This template works like {{main talk other}}, for more examples and technical details see full documentation there.

參見[编辑]

便於偵測命名空間的模板群:

更複雜的命名空間偵測模板:

Technical stuff: