模板:Dmbox

来自能源智库
SolarLib讨论 | 贡献2016年8月20日 (六) 23:10的版本 (创建页面,内容为“<table id=" {{#switch:{{{type|}}} | setindex = setindexbox | disambig | #default = disambigbox }}" class="metadata plainlinks dmbox {{#switch:{{{type|}}} | se...”)

(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳转至: 导航搜索
50px 模板-{zh-hans:文档; zh-hant:文件;}-[-{zh-hans:查看; zh-hant:檢視;}-] [编辑] [-{zh-hans:页面历史; zh-hant:頁面歷史; zh-cn:页面历史; zh-sg:页面历史; zh-hk:頁面歷史; zh-mo:頁面歷史; zh-tw:修訂記錄;}-] [清除]

Lua错误:无法创建进程:proc_open不可用。请检查PHP的指令配置“disable_functions”。 此為 {{dmbox}} 或 消歧義頁腳訊息框 元模板。

本模板用以建立消歧義及設置索引條目訊息框,像是 {{disambig}} 和 {{shipindex}}。

本模板運作方式類似 {{ambox}} 且大部分使用了相同的參數。主要差異在於本訊息框用在消歧義風格,並只有2種 "type" 設定選項。

用法

Simple usage example:

{{dmbox | text = Some text.}}
{{dmbox | type = setindex | text = Some text.}}

Complex example:

{{dmbox
| type      = setindex
| image     = {{nowrap| [[File:Schooner.svg|30px]] [[File:List gray.svg|30px]] }}
| textstyle = color: red; font-weight: bold; font-style: normal;
| text      = The message body text.
}}

Some other parameter combinations:

Parameters

List of all parameters:

{{dmbox
| type  = disambig / setindex
| image = none / [[File:Some image.svg|40px]]
| imageright = [[File:Some image.svg|40px]]
| style = CSS values
| textstyle = CSS values
| text  = The message body text. 
}}

type

If no type parameter is given the template defaults to type disambig.
disambig = Makes it so the {{disambig editintro}} is displayed when editing a page with this template on. (Means that this template internally sets the CSS id "disambig". The id is used by the javascript in MediaWiki:Common.js to determine if a page is a disambiguation page or not.) And adds Category:全部消歧義頁面 and Category:全部主條目消歧義頁面.
setindex = Does not trigger the {{disambig editintro}} when editing a page. (Because this instead sets the CSS id "setindexbox".) And adds Category:全部設置索引條目.

category

Don't use this parameter, it is currently broken. I will fix that. --David Göthberg (talk) 21:42, 4 March 2009 (UTC)

image

No parameter = If no image parameter is given, the template uses the default disambig or setindex image, depending on the type parameter.
An image = Should be an image with usual wiki notation. 30px - 50px width are usually about right depending on the image height to width ratio. (But the message box can handle images of any size.) For example:
image = [[File:Schooner.svg|30px]]
none = Means that no image is used.

imageright

No parameter = If no imageright parameter is given then no image is shown on the right side.
An image = Should be an image with usual wiki notation. 30px - 50px width are usually about right depending on the image height to width ratio. (But the message box can handle images of any size.) For example:
imageright = [[File:Nuvola apps bookcase.png|40px]]
Anything = Any other object that you want to show on the right side.

style

Optional CSS values used by the entire message box table. Without quotation marks " " but with the ending semicolons ;. For example:
style = margin-bottom: 0.2em;

textstyle

Optional CSS values used by the text cell. For example:
textstyle = text-align: center;

text

The message body text. This message box has italic text as default, thus no need to manually set that.

Technical details

This template currently uses hard coded styles and class names. Later it will only use CSS classes making it easier to skin. (In the meantime it can be skinned by using the "!important" keyword.)

If you need to use special characters in the text parameter then you need to escape them like this:

{{dmbox
| text  = <div>
Equal sign = and a start and end brace { } work fine as they are. 
But here is a pipe {{!}} and two end braces }}. 
And now a pipe and end braces |}}.
</div>
}}

Internally this meta-template uses HTML markup instead of wiki markup for the table code. That is the usual way we make meta-templates since wiki markup has several drawbacks. For instance it makes it harder to use parser functions and special characters in parameters.

For more technical details see the talk page. Since this template works almost exactly like {{ambox}}, {{tmbox}}, {{imbox}}, {{cmbox}} and {{ombox}} their talk pages and related pages might also contain more details.

參見

在訊息框(mbox)家族中有好几个元模板:

  • {{ambox}} – 用于条目訊息框。
  • {{tmbox}} – 用于讨论页訊息框。
  • {{imbox}} – 用于图像页訊息框。
  • {{cmbox}} – 用于分类訊息框。
  • {{ombox}} – 用于其他页面訊息框。
  • {{mbox}} – 有名字空间探测功能。某些消息框会用在几类页面并因此需要依据所用在的页面来改变风格,这种情况下的消息框可以用此元模板。

有相近关系的元模板:

  • {{fmbox}} – 用于页眉和页脚訊息框。
  • {{dmbox}} – 用于消歧义以及设定索引訊息框。
  • {{asbox}} – 用于小作品訊息框。

Other pages:

ca:Plantilla:Metadesambig diq:Şablon:Dmbox en:Template:Dmbox fa:الگو:Dmbox ja:Template:Dmbox km:ទំព័រគំរូ:Dmbox ms:Templat:Dmbox ne:ढाँचा:Dmbox or:ଛାଞ୍ଚ:Dmbox ps:کينډۍ:Dmbox pt:Predefinição:Dmbox ro:Format:Dmbox si:සැකිල්ල:Dmbox sr:Шаблон:Dmbox th:แม่แบบ:Dmbox tpi:Template:Dmbox tr:Şablon:Dmbox