Modèle:Mbox

Révision datée du 24 juin 2023 à 15:56 par Jerome (discussion | contributions) (1 version importée)
(diff) ← Version précédente | Voir la version actuelle (diff) | Version suivante → (diff)
Documentation du modèle

This is the {{mbox}} or multi namespace message box meta-template.

This meta-template is used to build message box templates that are used on several types of pages and thus need to change style depending on what page they are used on. Based on page type detected it uses one of {{ambox}}, {{tmbox}}, {{imbox}}, {{cmbox}} and {{ombox}}.

Note that this template should only be used for message boxes that really need to adapt their style. Most message boxes do not need this and should use one of {{ambox}}, {{tmbox}}, {{imbox}}, {{cmbox}} or {{ombox}} directly. Using those templates directly means that your template will look the same on its template page and at any other place you show it, which makes it clear on what kind of pages it is supposed to be used. It also gives you access to any extra features those templates offer, and it saves some server load.

Usage

This template takes the same parameters as {{ambox}} and {{imbox}} etc. See full documentation there.

Some of the boxes this template calls only handles images of max 52px width, thus that limitation also applies to this template or you will get ugly padding problems.

Demospace

This template optionally takes the "demospace" parameter to specify a namespace for testing and demonstration purposes. If you want to lock your message box to one style then instead use one of the other mboxes directly.

Namespace "Image:" was renamed to "File:" on 11 December 2008. This template was updated to understand both names well before that, thus it still works fine. For backwards compatibility it still understands "demospace = image" which means the same thing as "demospace = file". But using "demospace = image" is now deprecated.

Namespace "Book:" was added to the English Wikipedia on 28 December 2009. This template uses the {{ombox}} style on "Book:" pages or when "demospace=book". And it uses the {{tmbox}} style on "Book talk:" pages or when "demospace=talk". Note that "demospace=talk" means any talk space, there is no "demospace=book talk".

Parameters

List of all parameters:

{{mbox
| demospace = {{{demospace|}}} / main / talk / file / category / other
| 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|}}} / left / yes
| smallimage = none / [[Image:Some image.svg|30px]]
| smallimageright = none / [[Image:Some image.svg|30px]]
| smalltext  = A shorter message body text.
}}

Note: The small parameters only have effect when the template is on an article, talk page or an "other" page. For documentation on the small parameters see {{ambox}}, {{tmbox}} and {{ombox}}. Using the small parameters when they are not valid has no effect, but also does no harm.

TemplateData

This is the TemplateData documentation for this template used by VisualEditor and other tools.

Mbox

<templatedata> {

"description": "This is the or “multi namespace message box” meta-template.",

"format": "block", "params": { "demospace": { "label": "Demo Namespace", "suggestedvalues": [ "main", "talk", "file", "category", "other" ], "type": "string" }, "type": { "label": "Type", "suggestedvalues": [ "speedy", "delete", "content", "style", "notice", "move", "protection" ], "type": "string", "default": "notice", "suggested": true }, "image": { "label": "Image (left)", "suggestedvalues": [ "none" ], "default": "Depends on the “type” parameter.", "suggested": true, "type": "content" }, "imageright": { "label": "Image (right)", "type": "content" }, "style": { "label": "CSS Style", "type": "string" }, "textstyle": { "label": "Text CSS Style", "type": "string" }, "text": { "label": "Text", "suggested": true, "type": "content" }, "small": { "label": "Small?", "suggestedvalues": [ "", "left", "yes", "1" ], "default": "0", "type": "boolean" }, "smallimage": { "label": "Small Image (left)", "suggestedvalues": [ "none" ], "default": "{{{image}}}", "type": "content" }, "smallimageright": { "label": "Small Image (right)", "suggestedvalues": [ "none" ], "default": "{{{imageright}}}", "type": "content" }, "smalltext": { "label": "Small Text", "default": "{{{text}}}", "type": "content" } } } </templatedata>

Message boxes

Template Description
{{ambox}} Article message box, identifies problems or issues with the article
{{cmbox}} Category message box, {{ambox}} for categories
{{imbox}} Image message box, {{ambox}} for file (image) pages
{{ombox}} Other pages message box, {{ambox}} for pages of the types User, Wikipedia, MediaWiki, Template, Help, Portal and any new future namespaces
{{tmbox}} Talk page message box, {{ambox}} for talk pages
The following templates are not called by Mbox
{{fmbox}} used in system messages

See also