今天是2024年7月2日 第27周 星期二

代人,时大变了。

我们生活在大地上,但我们的梦想超越天空。

模板:Dmbox

出自Akarin
跳至導覽 跳至搜尋
50px 模板文件[檢視] [編輯] [歷史] [清除快取]


此為 {{dmbox}} 或 消歧義頁腳訊息框 元模板。

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

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

用法

簡單用法示例:

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

複雜用法示例:

{{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.
}}

其他一些參數組合:

參數

所有的參數清單:

{{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.

技術細節

該模板當前使用硬編碼的樣式和類名稱。以後,它將僅使用CSS類,使皮膚更容易使用。 (與此同時,可以使用「 !important </ code>」關鍵字對它進行外觀設置。)

如果需要在text參數中使用特殊字符,則需要像這樣轉義它們:

{{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>
}}

在內部,此元模板使用HTML標記而不是表代碼的Wiki標記。這是我們製作元模板的常用方法,因為Wiki標記有幾個缺點。例如,它使在參數中使用解析器函數和特殊字符變得更加困難。

有關更多技術細節,請參見 討論頁面。由於此模板的工作原理幾乎與{{ ambox}},{{ tmbox}},{{ imbox}},{{ cmbox}}和{{ ombox}}的討論頁一樣,相關頁面也可能包含更多詳細信息。

參見

在訊息框(mbox)家族中的元模板:

  • {{ambox}}:用於條目訊息框
  • {{tmbox}}:用於討論頁訊息框
  • {{imbox}}:用於圖像頁訊息框
  • {{cmbox}}:用於分類訊息框
  • {{ombox}}:用於其他頁面訊息框
  • {{mbox}}:有名字空間探測功能。某些消息框會用在幾類頁面並因此需要依據所用在的頁面來改變風格,這種情況下的消息框可以用此元模板。

有相近關係的元模板:

  • {{fmbox}}:用於頁眉和頁腳訊息框
  • {{dmbox}}:用於消歧義以及設定索引訊息框
  • {{asbox}}:用於小作品訊息框


其他頁面:

  • {{disambig}} – 通用消歧義訊息模板。
  • {{SIA}} – The generic set index article message box.