Template:Mbox

From UBC Wiki
Documentation icon Template documentation[view] [edit] [history] [purge]

Usage

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

It is used to build message box templates, using CSS classes to reskin it for specific namespaces. It offers several different colours, uses default images if no image parameter is given and it has some other features.

Ading mbox in Visual Editor

If you want to add mbox in Visual Editor (default editor), follow the step below:

  1. Go to Insert>Template
  2. Under Add a template, type mbox. Then click on Add template.
  3. Fill in the parameters (For the explanation of paramesters, see below), then insert the template.

Usage

{{mbox
| type      = query (optional)
| image     = Emblem-question-yellow.svg (optional)
| style     = width:400px; color:red; font-weight:bold; font-style:italic; (optional)
| text      = The message body text.
}}
This message box is using an invalid "type=query" parameter and needs fixing.

Message box types

This message box is using an invalid "type=warning" parameter and needs fixing.
This message box is using an invalid "type=serious" parameter and needs fixing.
This message box is using an invalid "type=merge" parameter and needs fixing.
This message box is using an invalid "type=growth" parameter and needs fixing.
This message box is using an invalid "type=idea" parameter and needs fixing.
This message box is using an invalid "type=query" parameter and needs fixing.

Image message box types

In the Image namespace, several additional options are available. It is recommended you still use {{imbox}} for these boxes in the meantime, as imbox uses different markup in line with other Ambox implementations and the image margins used on mbox are different.

This message box is using an invalid "type=warning" parameter and needs fixing.
This message box is using an invalid "type=serious" parameter and needs fixing.
This message box is using an invalid "type=query" parameter and needs fixing.
This message box is using an invalid "type=free" parameter and needs fixing.
This message box is using an invalid "type=pd" parameter and needs fixing.
This message box is using an invalid "type=nonfree" parameter and needs fixing.

Other images

The default images shown above are mostly for convenience. In many cases it is more appropriate to use more specific images. These examples use the image parameter to specify an image other than the default images.

This message box is using an invalid "type=query" parameter and needs fixing.
This message box is using an invalid "type=free" parameter and needs fixing.

Special

Some other parameter combinations.

Technical details

This template uses CSS classes.

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

{{mbox
| 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>
}}

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.