Difference between revisions of "Template:Tmbox"

From Chevy Wiki
Jump to navigation Jump to search
m (1 revision)
 
m (1 revision)
 
Line 1: Line 1:
{{#ifeq:{{{small|}}}|yes
{{#ifeq:{{{small|}}}|yes
| {{tmbox/sandbox/core
| {{tmbox/core
   | small = yes
   | small = yes
   | type  = {{{type|}}}
   | type  = {{{type|}}}
Line 9: Line 9:
   | text  = {{#if:{{{smalltext|}}}| {{{smalltext}}} | {{{text}}} }}
   | text  = {{#if:{{{smalltext|}}}| {{{smalltext}}} | {{{text}}} }}
   }}
   }}
| {{tmbox/sandbox/core
| {{tmbox/core
   | type  = {{{type|}}}
   | type  = {{{type|}}}
   | image = {{{image|}}}
   | image = {{{image|}}}
   | imageright = {{{imageright|}}}  
   | imageright = {{{imageright|}}}
   | style = {{{style|}}}
   | style = {{{style|}}}
   | textstyle = {{{textstyle|}}}
   | textstyle = {{{textstyle|}}}
Line 19: Line 19:
}}<noinclude>
}}<noinclude>


=== Sandbox for {{tl|tmbox}} ===
{{pp-template|small=yes}}
 
{{documentation}}
Here we can test new code versions.
<!-- Add categories and interwikis to the /doc subpage, not here! -->
 
The box above is template code on this page, the boxes below are transclusions of this page and show how that code renders when the box is stacked. If you have updated the code above then you have to {{purge|purge this page}} to see the effect on the examples below.
 
The code in this test template works together with {{tl|tmbox/sandbox/core}}.
 
{{tmbox/sandbox
| type = speedy
| text = speedy
}}
{{tmbox/sandbox
| type = delete
| text = delete
}}
[[Image:Canis lupus laying.jpg|thumb|60px]]
{{tmbox/sandbox
| type = content
| text = content, lots of text lots of text lots of text lots of text lots of text lots of text lots of text lots of text lots of text
| imageright = [[Image:Nuvola apps bookcase.svg|40x40px]]
}}
{{tmbox/sandbox
| type = style
| text = style, lots of text lots of text lots of text lots of text lots of text lots of text lots of text lots of text lots of text
| imageright = [[Image:Nuvola apps bookcase.svg|40x40px]]
}}
{{tmbox/sandbox
| type = notice
| text = notice, lots of text lots of text lots of text lots of text lots of text lots of text lots of text lots of text lots of text
| imageright = [[Image:Nuvola apps bookcase.svg|80px]]
}}
{{tmbox/sandbox
| type = move
| text = move
}}
{{shortcut|WP:TEST}}
{{tmbox/sandbox
| type = protection
| text = protection
}}
 
Some text just to test bottom margin.
 
=== Special ===
 
Some other parameter combinations.
 
{{tmbox/sandbox
| text  = No type and no image given ('''default''')
}}
 
{{tmbox/sandbox
| image = none
| text  = No type and '''image=none''' – No image is used and the '''text''' uses the whole message box area.
}}
 
{{tmbox/sandbox
| image =
| text  = image =
}}
 
{{tmbox/sandbox
| image = [[Image:Nuvola apps bookcase.svg|100px]]
| text  = Trying large left side image. - lots of text lots of text lots of text lots of text lots of text lots of text lots of text lots of text lots of text
}}
 
{{tmbox/sandbox
| image = [[Image:Nuvola apps bookcase.svg|100px]]
| text  = Trying large left and right side image. - lots of text lots of text lots of text lots of text lots of text lots of text lots of text lots of text lots of text
| imageright = [[Image:Nuvola apps bookcase.svg|100px]]
}}
 
=== Parameters ===
 
List of all parameters:
 
<pre>
{{tmbox/sandbox
| type  = speedy / delete / content / style / notice / move / protection
| image = none / [[Image:Some image.svg|40px]]
| imageright = [[Image:Some image.svg|40px]]
| style = CSS value
| textstyle = CSS value
| text  = The message body text.
| small = yes / {{{small|}}}
| smallimage = none / [[Image:Some image.svg|30px]]
| smallimageright = none / [[Image:Some image.svg|30px]]
| smalltext  = A shorter message body text.
}}
</pre>
 
=== Examples of varying width ===
 
These examples were copied from the ombox, so their images and texts might seem strange. But we are just testing image cell widths here.
 
{{tmbox/sandbox
| type      = notice
| image      = [[Image:Blue check.svg|30px]]
| text      =
'''This page documents an English Wikipedia [[Wikipedia:Policies and guidelines|guideline]].''' It is a generally accepted standard that editors should follow, though it should be treated with [[Wikipedia:Use common sense|common sense]] and the [[Wikipedia:Ignore all rules|occasional exception]]. When editing this page, please ensure that your revision reflects [[Wikipedia:Consensus|consensus]]. When in doubt, discuss on the [[{{TALKPAGENAME}}|talk page]].
}}
 
{{tmbox/sandbox
| type      = notice
| image      = [[Image:Purple question mark.svg|50px]]
| text      =
'''The following is a ''proposed'' Wikipedia {{{type|[[Wikipedia:Policies and guidelines|policy, guideline,]] or process}}}.''' <br> The proposal may still be in development, under [[{{NAMESPACE}} talk:{{PAGENAME}}|discussion]], or in the process of gathering [[Wikipedia:Consensus|consensus]] for adoption. Thus references or links to this page should not describe it as "policy".
}}
 
{{tmbox/sandbox
| type      = notice
| image      = [[Image:Purple question mark.svg|70px]]
| imageright = {{shortcut|WP:SHORT}}
| text      =
'''The following is a ''proposed'' Wikipedia {{{type|[[Wikipedia:Policies and guidelines|policy, guideline,]] or process}}}.'''
}}
 
{{tmbox/sandbox
| type      = notice
| image      = [[Image:Crystal package settings.png|40px]]
| imageright = {{shortcut|WP:SHORT}}
| text      =
This page is a '''how-to guide''' detailing a practice or process on the English Wikipedia.
}}
 
=== Small message boxes ===
 
{{tmbox/sandbox
| type      = notice
| small      = yes
| text      =
type = notice, small = yes, no image set.
}}
{{tmbox/sandbox
| type      = notice
| small      = yes
| image      = [[Image:Imbox notice.png|40x40px]]
| text      =
type = notice, small = yes, image = <nowiki>[[Image:Imbox notice.png|40x40px]]</nowiki>
}}
{{tmbox/sandbox
| type      = notice
| small      = yes
| image      = [[Image:Imbox notice.png|30x30px]]
| imageright = [[Image:Nuvola apps bookcase.png|30x30px]]
| text      =
type = notice, small = yes, image = <nowiki>[[Image:Imbox notice.png|30x30px]], imageright = [[Image:Nuvola apps bookcase.png|30x30px]]</nowiki>
}}
{{tmbox/sandbox
| type      = notice
| small      = yes
| image      = [[Image:Information icon4.svg|30x30px]]
| imageright = [[Image:Nuvola apps bookcase.png|30x30px]]
| text      =
type = notice, small = yes, image = <nowiki>[[Image:Information icon4.svg|30x30px]], imageright = [[Image:Nuvola apps bookcase.png|30x30px]]</nowiki>
}}
{{tmbox/sandbox
| type      = style
| small      = yes
| text      =
type = style, small = yes, no image set.
}}
{{tmbox/sandbox
| type      = style
| small      = yes
| image      = [[Image:Imbox style.png|40x40px]]
| text      =
type = style, small = yes, image = <nowiki>[[Image:Imbox style.png|40x40px]]</nowiki>
}}
{{tmbox/sandbox
| type      = style
| small      = yes
| image      = [[Image:Broom icon.svg|30x30px]]
| text      =
type = style, small = yes, image = <nowiki>[[Image:Broom icon.svg|30x30px]]</nowiki>
}}
{{tmbox/sandbox
| type      = notice
| small      = yes
| image      = none
| text      =
type = notice, small = yes, image = none
}}
 
The small talkpage message boxes to the right use different images. Some use the 40px png images with optimised background, which makes their background look right even in some older web browsers. When those png images get rescaled to 30px they loose their optimised background and get somewhat blurred. For comparison some of the boxes to the right use the svg versions instead which doesn't get as blurred when scaled to 30px. If we decide to use 30px images for the small boxes then we perhaps should make a set of 30px png images with optimised background or perhaps use the svg images. But the blurring is really only noticeable in low screen resolutions so most users will never see a difference, and the old browsers that need the optimised background are not used much anymore, so we can probably use the rescaled png images as is for the small boxes. Since that means the simplest code for the template.
 
Some text to test box flow:
 
{{lorem ipsum|3}}
 
{{clear}}
 
=== Testing box flow ===
 
{{tmbox/sandbox
| type      = notice
| text      =
Box 1: type = notice, no small set, no image set.
}}
{{tmbox/sandbox
| type      = notice
| small      = yes
| text      =
Box 2: type = notice, small = yes, no image set.
}}
{{tmbox/sandbox
| type      = style
| small      = yes
| text      =
Box 3: type = style, small = yes, no image set.
}}
{{tmbox/sandbox
| type      = notice
| text      =
Box 4: type = notice, no small set, no image set.
}}
 
{{lorem ipsum|2}}
 
{{clear}}
 
=== Testing smallimage, smallimageright and smalltext ===
 
{{tmbox/sandbox
| text      = Long text.
| small      = yes
| smalltext  =
Smalltext: no image set, small = yes, smalltext set.
}}
{{tmbox/sandbox
| image      = [[Image:Nuvola apps bookcase.png|40px]]
| text      = image = <nowiki>[[Image:Nuvola apps bookcase.png|40px]]</nowiki>
| small      = yes
}}
{{tmbox/sandbox
| image      = none
| text      = image = none, smallimage = <nowiki>[[Image:Nuvola apps bookcase.png|30px]]</nowiki>
| small      = yes
| smallimage  = [[Image:Nuvola apps bookcase.png|30px]]
}}
{{tmbox/sandbox
| text      = smallimage = <nowiki>[[Image:Nuvola apps bookcase.png|30px]]</nowiki>
| small      = yes
| smallimage  = [[Image:Nuvola apps bookcase.png|30px]]
}}
{{tmbox/sandbox
| text      = smallimage = none
| small      = yes
| smallimage  = none
}}
{{tmbox/sandbox
| imageright      = none
| text      = imageright = none, smallimageright = <nowiki>[[Image:Nuvola apps bookcase.png|30px]]</nowiki>
| small      = yes
| smallimageright  = [[Image:Nuvola apps bookcase.png|30px]]
}}
{{tmbox/sandbox
| imageright      = [[Image:Nuvola apps bookcase.png|40px]]
| text      = imageright = <nowiki>[[Image:Nuvola apps bookcase.png|40px]]</nowiki>, smallimageright = none
| small      = yes
| smallimageright  = none
}}
 
{{lorem ipsum|3}}
 
{{clear}}
 
</noinclude>
</noinclude>

Latest revision as of 15:01, 3 February 2009

[edit] Template-info.svg Template documentation

This is the {{tmbox}} or talk page message box meta-template.

It is used to build message box templates for talk pages, such as {{central}} etc. It offers several different colours, uses default images if no image parameter is given and it has some other features.

This template should normally not be used for WikiProject banners. They have special needs and thus have their own meta-templates. See the "See also" section below for links.

This template works similarly to {{ambox}} and uses the same parameters.

We are deploying!

After discussions on the talk page of this template and announcing it at several places for some time we are now deploying this template. Feel free to convert any message boxes used on talk pages to use this meta-template. If you find any tricky cases then list them on the talk page of this template and you'll get help.

When this template is used to build talk page message boxes those boxes should contain explanatory texts just like before. (The same texts as before or new improved texts.) If there are more specific images in the boxes or you know a better image, then use them instead of the default images shown here.

Suggested style standard

The types of talkpage messageboxes follow the same naming convention as the boxes for all other namespaces, but the type of any particular talkpage messagebox may not be as obvious as in other namespaces. When deciding on the type to use for a talkpage messagebox, please consider the following guidelines:

  • speedy should only be used for speedy deletion templates.
  • delete should only be used for templates relating to ongoing deletion discussions. Please do not use this type just to get a red border for a messagebox.
  • content and style should be used for warnings and alerts. Use content (which has an orange border) for more important and immediate alerts, and style (yellow border) for less important warnings. Messageboxes of these types should ideally be transitory: they should not be expected to remain on a talkpage indefinitely.
  • move and protection should only be used for messageboxes relating to moves and merges, and page protection, respectively.
  • The notice type should be used for the majority of talkpage messageboxes; those that are intended to convey or summarise information. If a talkpage messagebox does not obviously fit into one of the other types, it is probably a notice type.

Usage

Simple usage example:

{{tmbox | text = Some text.}}


Complex example:

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

Talk page message box types

The following examples use different type parameters but use no image parameters thus they use the default images for each type.

Special

Some other parameter combinations.

Parameters

List of all parameters:

{{tmbox
| type  = speedy / delete / content / style / notice / move / protection
| image = none / [[Image:Some image.svg|40px]]
| imageright = [[Image:Some image.svg|40px]]
| style = CSS values
| textstyle = CSS values
| text  = The message body text. 
| small = {{{small|}}} / yes
| smallimage = none / [[Image:Some image.svg|30px]]
| smallimageright = none / [[Image: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 = [[Image: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 = [[Image: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.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 = [[Image: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 = [[Image:Nuvola apps bookcase.png|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.

See also

There are several meta-templates in the mbox family:

  • {{ambox}} – For article message boxes.
  • {{tmbox}} – For talk page message boxes.
  • {{imbox}} – For image page message boxes.
  • {{cmbox}} – For category message boxes.
  • {{ombox}} – For other pages message boxes.
  • {{mbox}} – Has namespace detection, for message boxes that are used on several types of pages and thus need to change style depending on what page they are used on.

Closely related meta-templates:

  • {{fmbox}} – For header and footer message boxes.
  • {{dmbox}} – For disambiguation and set index message boxes.

Other pages:

WikiProject banners:

no:Mal:Tmbox hsb:Předłoha:Tmbox ro:Format:Meta-casetămd uk:Шаблон:Tmbox