模板: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.