Template:Tmbox/doc

信息框元模板
模板背景
{{Ambox}}條目
{{Cmbox}}分類
{{Imbox}}圖片
{{Tmbox}}討論
{{Fmbox}}頁腳/標題
{{Ombox}}其他頁面
{{Mbox}}自動偵測
{{Asbox}}小作品
{{Dmbox}}消歧義

这个模板为讨论页消息提示元模板。

这个模板被用来构建讨论页消息提示框,如{{central}}。 它提供了几种不同的颜色。如果没有给出图像参数,则使用默认的图像,而且它还有其他一些功能。

这个模板通常不应该被用于WikiProject横幅。他们有特殊的需求,因此有自己的元模板。参见下面的 "另见 "部分的链接。

该模板与{{ambox}}模板工作原理相类似,并使用相同的参数。

我们正在部署!

讨论页面上讨论和公示后,我们现在部署这个模板。欢迎将任何在用户讨论页面上使用的消息框转换为使用这个元模板。如果你发现有什么棘手的情况,那么就在本模板的讨论页上列出,你会得到帮助。

当使用这个模板来构建讨论页消息提示框时,这些框应该像以前一样包含说明性文字。(和以前一样的文本或新的改进文本)。如果框中有更具体的图片,或者你知道的更好的图片,那么就用它们来代替这里显示的默认图片。

建议的样式标准

讨论页信息框的类型与所有其他命名空间的信息框遵循相同的命名惯例,但任何特定讨论页信息框的类型可能不像其他命名空间那样明显。 在决定通话页消息框的类型时,请考虑以下准则:

  • speedy只应该被用于快速删除模板
  • delete 只应该被用于与正在进行的删除讨论相关的模板。不要为了给自己消息框加个好看的红边框使用这个参数。
  • contentstyle只应该被用于警告和提醒。content有橙色边框,用于更加重要、紧急的警告。style有黄色边框,用于较低重要度警告。这两种类型的信息框只应用于临时用途,不宜在讨论页上长期留存。
  • moveprotection只应该被用于与移动、合并、页面保护相关的消息框。
  • notice参数应该被用于大部分讨论页信息框,以提醒,告知相关信息。这个参数几乎可以通用。

用法

一些用法:

{{tmbox | text = 示例文本}}

复杂用法:

{{tmbox
| type      = style
| image     = [[File:Emblem-question-yellow.svg|40px]]
| style     = width: 400px; 
| textstyle = color: red; font-weight: bold; font-style: italic;
| text      = The message body text.
}}

讨论页消息框样式

以下示例为指定不同type参数但不指定图片参数输出的默认图像

更高级的操作

各种参数的混合实例:

  • type、image参数留空:默认样式
  • image参数指定为none(image=none):纯信息
  • 实现左右两张图片(image = [[File:Gnome globe current event.svg|42px]] | imageright = [[File:Nuvola apps bookcase.svg|40px]]):指定imageright参数

参数

各参数使用列表:

{{tmbox
| type  = speedy / delete / content / style / notice / move / protection
| image = none / [[File:Some image.svg|40px]]
| imageright = [[File:Some image.svg|40px]]
| style = CSS values
| textstyle = CSS values
| text  = The message body text. 
| small = {{{small|}}} / yes
| smallimage = none / [[File:Some image.svg|30px]]
| smallimageright = none / [[File:Some image.svg|30px]]
| smalltext  = A shorter message body text.
}}

type

If no type parameter is given the template defaults to type notice. That means it gets a gray border.

image

No parameter = If no image parameter is given the template uses a default image. Which default image it uses depends on the type parameter.
An image = Should be an image with usual wiki notation. 40px - 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:Crystal package settings.png|40px]]
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. 40px - 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.svg|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.5em;

textstyle

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

text

The message body text.

The small parameters

small

yes = Makes it a smaller right floating message box. This also makes the default images smaller. Note that any data fed to the smallimage, smallimageright and smalltext parameters is only used if "small=yes". To make it so your template also understands the small parameter you can use this code:
small = {{{small|}}}

smallimage

No parameter = If no smallimage parameter is given then this template falls back to use the image parameter. If the image parameter also is empty then a small default image is used.
An image = Should be an image with usual wiki notation. 30px width is usually about right. For example:
smallimage = [[File:Crystal package settings.png|30px]]
none = Means that no image is used. This overrides any image fed to image, when "small=yes".

smallimageright

No parameter = If no smallimageright parameter is given then this template falls back to use the imageright parameter. If the imageright parameter also is empty then no image is shown on the right side.
An image = Should be an image with usual wiki notation. 30px width is usually about right. For example:
smallimageright = [[File:Nuvola apps bookcase.svg|30px]]
Anything = Any other object that you want to show on the right side.
none = Means that no right side image is used. This overrides any image fed to imageright, when "small=yes".

smalltext

A shorter version of the message body text. If no smalltext parameter is given then this template falls back to use the text parameter.

Technical details

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

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

This template uses the tmbox CSS classes in MediaWiki:Common.css for most of its looks, thus it is fully skinnable.

This template calls {{tmbox/core}} which holds most of the code for {{tmbox}}, while {{tmbox}} itself does parameter preprocessing.

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

WikiProject banners: