Template:IP-user other
本模板可以让其他模板检测某个页面是“IP用户”的用户(讨论)页,还是其他类型的页面,对子页面同样有效,例如“User talk:12.34.56.78/subpage”也能返回“IP-user”。
模板也支持IPv6,如“User:2001:B011:7009:18A0:FC2F:9F5F:5B46:306E”返回“IP-user”。
使用方法
[编辑]本模板通常需要两个参数:
{{IP-user other | IP-user text | Other pages text }}
如果本页面是IP用户的用户页或讨论页,则返回:
- IP-user text
否则返回:
- Other pages text
page
参数
[编辑]本模板也接受额外的page参数,用来判断该页面(而不是当前页面)的类别:
{{IP-user other | IP-user text | Other pages text | page = User:12.34.56.78 }}
不管当前页面是什么类别,都会返回:
- IP-user text
这和在那个页面上使用该模板的效果完全一样。page
参数不需要是当前存在的页面。
如果page
参数为空或未定义,判断的就是当前页面。
你也可以给调用该模板的模板加上page
参数,这样就可以让该模板同样可以在不同页面实现不同显示。像这样:
{{IP-user other | IP-user text | Other pages text | page = {{{page|}}} }}
技术细节
[编辑]Templates have a problem to handle parameter data that contains equal signs "=
". But that is easily solved by using numbered parameters. Like this:
{{IP-user other | 1 = IP-user text: "A = B" | 2 = Other pages text: "C = D" | page = {{{page|}}} }}
If your template is using tables, then you need to know this:
Templates have a problem to handle parameter data that contains pipes "|
", unless the pipe is inside another template {{name|param1}}
or inside a piped link [[Help:Template|help]]
. Thus templates can not handle wikitables as input unless you escape them by using the {{!}} template. This makes it hard to use wikitables as parameters to templates. Instead the usual solution is to use "HTML wikimarkup" for the table code, which is more robust.
This template calls {{IP-user other/core}} which holds most of the code for {{IP-user other}}, while {{IP-user other}} itself does parameter preprocessing.
For more technical details, see the talk page.