跳转到内容

模板:Talk other/doc

维基百科,自由的百科全书

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: