模板:Tmbox/doc
此頁面是Template:Tmbox的模板文件。 此頁面可能包含了模板的使用說明、分類和其他內容。 |
此模板文件被引用於約302,000個頁面,佔全部頁面的4%。 為了避免造成大規模的影響,所有對此模板文件的編輯應先於沙盒、測試樣例或您的沙盒上測試。 測試後無誤的版本可以一次性地加入此模板文件中,但是修改前請務必於討論頁發起討論。 模板引用數量會自動更新。 |
此模板使用Lua語言: |
本模板使用以下模板樣式: |
訊息框元模板 | |
---|---|
模板 | 背景 |
{{Ambox}} | 條目 |
{{Cmbox}} | 分類 |
{{Imbox}} | 圖片 |
{{Tmbox}} | 討論 |
{{Fmbox}} | 頁腳/標題 |
{{Ombox}} | 其他頁面 |
{{Mbox}} | 自動偵測 |
{{Asbox}} | 小作品 |
{{Dmbox}} | 消歧義 |
此模板的文檔不存在、不全面或不能詳細描述其功能及/或其代碼中的參數。請幫助擴充並改進其文檔。 |
這個模板為討論頁消息提示元模板。
這個模板被用來構建討論頁消息提示框,如{{central}}。 它提供了幾種不同的顏色。如果沒有給出圖像參數,則使用默認的圖像,而且它還有其他一些功能。
這個模板通常不應該被用於WikiProject橫幅。他們有特殊的需求,因此有自己的元模板。參見下面的 "另見 "部分的連結。
該模板與{{ambox}}模板工作原理相類似,並使用相同的參數。
我們正在部署!
在討論頁面上討論和公示後,我們現在部署這個模板。歡迎將任何在用戶討論頁面上使用的消息框轉換為使用這個元模板。如果你發現有什麼棘手的情況,那麼就在本模板的討論頁上列出,你會得到幫助。
當使用這個模板來構建討論頁消息提示框時,這些框應該像以前一樣包含說明性文字。(和以前一樣的文本或新的改進文本)。如果框中有更具體的圖片,或者你知道的更好的圖片,那麼就用它們來代替這裡顯示的默認圖片。
建議的樣式標準
討論頁信息框的類型與所有其他命名空間的信息框遵循相同的命名慣例,但任何特定討論頁信息框的類型可能不像其他命名空間那樣明顯。 在決定通話頁消息框的類型時,請考慮以下準則:
- speedy只應該被用於快速刪除模板。
- delete 只應該被用於與正在進行的刪除討論相關的模板。不要為了給自己消息框加個好看的紅邊框使用這個參數。
- content和style只應該被用於警告和提醒。content有橙色邊框,用於更加重要、緊急的警告。style有黃色邊框,用於較低重要度警告。這兩種類型的信息框只應用於臨時用途,不宜在討論頁上長期留存。
- move和protection只應該被用於與移動、合併、頁面保護相關的消息框。
- 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=speedy——快刪模板 |
type=delete——刪除模板 |
type=content——大部分警告和提醒 |
type=style——較小警告和問題 |
type=notice – Notices and messages of any kind, both permanent and temporary. |
type=move – Merge, split, rename and transwiki messages and proposals. |
type=protection – Protection templates. |
更高級的操作
各種參數的混合實例:
- type、image參數留空:默認樣式
No type and no image given (default) |
- image參數指定為none(image=none):純信息
No type and image=none – No image is used and the text uses the whole message box area. |
- 實現左右兩張圖片(image = [[File:Gnome globe current event.svg|42px]] | imageright = [[File:Nuvola apps bookcase.svg|40px]]):指定imageright參數
image = [[File:Gnome globe current event.svg|42px]] imageright = [[File:Nuvola apps bookcase.svg|40px]] |
參數
各參數使用列表:
{{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 |
type = style small = yes |
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|}}}
small = yes image = [[File:Nuvola apps bookcase.svg|40px]] smallimage = [[File:Nuvola apps bookcase.svg|30px]] |
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".
small = yes imageright = [[File:Nuvola apps bookcase.svg|40px]] |
small = yes imageright = [[File:Nuvola apps bookcase.svg|40px]] smallimageright = none |
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>
}}
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 |}}. |
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}}
:有名字空間探測功能。某些消息框會用在幾類頁面並因此需要依據所用在的頁面來改變風格,這種情況下的消息框可以用此元模板。
有相近關係的元模板:
Other pages:
- Wikipedia:Talk page templates – The guideline specifying the styles for talk page message boxes.
WikiProject banners:
- {{WikiProjectBannerShell}} and {{WPBannerMeta}} – A system for collapsing, wrapping and creating WikiProject banners.
- {{WikiProjectBanners}} – Another system for collapsing WikiProject banners.