Template:Imbox/doc
This is a documentation subpage for Template:Imbox. It may contain usage information, categories and other content that is not part of the original template page. |
This template uses Lua: |
Message box meta-templates | |
---|---|
template | context |
{{Ambox}} | article |
{{Cmbox}} | category |
{{Imbox}} | image |
{{Tmbox}} | talk |
{{Fmbox}} | footer / header |
{{Ombox}} | other pages |
{{Mbox}} | auto-detect |
{{Asbox}} | article stub |
{{Dmbox}} | disambiguation |
This is the {{Imbox}}
(Image message box) metatemplate that is used to build message box templates for file (image) pages. It offers several different colors, uses default images if no image parameter is given and has some other features as well.
This template works near-identically to {{Ambox}}
and uses the same parameters.
Examples
Simple
{{Imbox|text=Some text.}}
⮷
Some text. |
Complex
{{Imbox|type=style|image=[[File:Emblem-question-yellow.svg|40px]]|style=width: 400px;|textstyle=color: #f00; font-style: italic; font-weight: 700;|text=The message body text.}}
The message body text. |
Usage
Image message box types
The following examples use different type
parameters but no image parameters, thus they use the default images for each type.
type=speedy – the type designed to draw the most attention. |
type=delete – very similar to speedy, minus the red background. |
type=content – for major warnings and problems. |
type=style – for minor warnings and problems. |
type=notice a versatile type for notices and messages of any kind, both permanent and temporary. |
type=move – for important but short-lived situations, such as page move and rename proposals. |
type=protection – ideal for long-term or permanent information about pages. |
type=license – for internal wiki functions, like licenses on page in File: namespace (e.g. {{GFDL}} . |
type=featured – for announcements and helpful messages targeted mostly towards readers and less so fellow editors. |
Custom images
The default images shown above are mostly for convenience. In many cases, it is more appropriate to use an image more specifically related to the message being displayed. These examples use the image
parameter to specify an image other than the default.
type=style image=[[File:Zoowiki zetapin logo.png|x48px]] |
type=move image=[[File:Zeta templatelogo.png|x48px]] |
type=license image=[[File:Mlogo.png|48px]] |
Special
Some other parameter combinations…
No type and no image given (default) |
No type and |image=none – No image is used and the |text= uses the whole message box area. |
type=license image=[[File:PD-icon.svg|x36px]]<br />[[File:Ambox warning yellow.svg|x36px]] imageright=[[File:Mike.png|x72px]] |
type=license image=[[File:PD-icon.svg|x40px]] below={{Imbox|type=content|text='''This license tag is deprecated!'''}} | |||
|
Parameters
A list of all the template parameters:
{{Imbox | name = Name of the template | type = speedy / delete / content / style / notice / move / protection / license / featured | image = none / [[File:Some image.svg|40px]] | imageright = [[File:Some image.svg|40px]] | style = CSS value(s) | textstyle = CSS value(s) | text = The message body text. | below = More text, or another Imbox. | plainlinks = no }}
|name=
- (optional) The name of the template. This adds a CSS class with the name
box-name
to the HTML box element, for use by bots or scripts. |type=
- If no
type
parameter is given, the template defaults to typenotice
. That means it gets a blue 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 within the usual wiki 'File:' notation; 40–50px in width is usually about right, depending on the image's aspect ratio (but the message box can handle images of any size). For example:
image=[[File:Gnome-dev-camera.svg|40px]]
|image=none
⟹ Which means that an image is used.|imageright=
- No parameter ⟹ If no
imageright
parameter is given, then no image is shown on the right side. - An image ⟹ This should be an image within the usual wiki 'File:' notation; 40–50px in width is usually about right, depending on the image's aspect 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 of the message box.
|style=
- Optional CSS property declarations, used by the entire message box table; not enclosed in quotation marks (
" "
but each terminated with a semicolon (;
). For example:style=margin-bottom: 0.5em;
|textstyle=
- Optional CSS property declarations, used only by the text cell of the message box table. For example:
textstyle=text-align: center;
|text=
- The message body text.
|below=
- A full-width area below the images and text area; it can take text or any kind of object, or even another Imbox.
below={{Imbox|type=content|text=This license tag is deprecated.}}
Technical details
The 'Image:' namespace was renamed to 'File:' on December 11, 2008, however this template long predates that, which is why it is named "Imbox" as in "Image message box."
If you need to use special characters in the text parameter, then you need to escape them like this:
{{Imbox | 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> }}
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 imbox
CSS classes in Module:Message box/imbox.css for most of its styling, thus it is fully skinnable.
Internally, this meta-template uses HTML markup instead of wiki markup for the table code. That is the usual way meta-templates are coded since wiki markup has several limitations. For instance, it makes it harder to use parser functions and special characters in parameters.
The default images for this meta-template are (mostly) in PNG format instead of the newer SVG. The main reason is that some older web browsers have trouble with the transparent SVG images. For those older browsers, these PNG images have been modified so that the color of their default background matches the background color of the template. The default background that the MediaWiki parser renders for SVG images is always pure white, and that creates a white box around the images when displayed in older browsers.
For more technical details, see the talk page. Since this template works almost exactly like the other message boxes, their talk pages and related pages might also contain useful information; see the § See also section below.
See also
- {{Ambox}}, for messageboxes on article pages.
- {{Cmbox}}, for messageboxes on category pages.
- {{Imbox}}, for messageboxes on file (image) pages.
- {{Tmbox}}, for messageboxes on talk pages.
- {{Fmbox}}, for header and footer messageboxes.
- {{Ombox}}, for messageboxes on other types of page.
- {{Mbox}}, for messageboxes that are used in different namespaces and change their presentation accordingly.
Closely related metatemplates:
- {{Asbox}}, for messageboxes in article stubs.
- {{Dmbox}}, for messageboxes on disambiguation or set-index pages.
- {{Ivmbox}}, a simple full-width box with default ivory background intended to frame important messages or notices.
Templates intended to be used in conjunction with Mboxes:
- {{Ombox/shortcut}}, an alternative to {{Shortcut}} for use in Mbox templates