Template:Messagebox/doc

From NWN Lexicon
Jump to: navigation, search
Warning icon orange.png This template is used on a large number of pages.

In order to prevent unnecessary server load, edits should be kept to a minimum. Please experiment in your user page, and consider discussing your changes on the talk page before applying them.

Information icon.png Editing a template causes all pages that use the template to be re-rendered. If the template is used often, this can put a lot of load on the server since it fills up the job queue.

Parameters

The following parameters are accepted by the {{{messagebox}}} template:

text

The text parameter contains the text to display in the messagebox. You can also set the text as an unnamed parameter. For example, the following two sets of code yield the same messagebox:

{{messagebox|This is a messagebox!}}
{{messagebox|text=This is a messagebox!}}
Information icon.png This is a messagebox!

Alternatively, the parameter can be arbitrary wikicode, e.g. an image:

{{messagebox|[[Image:File.png|200px]]}}

This produces:

Information icon.png File.png

type

The "type" parameter will determine the icon displayed and give the table a CSS class. If you do not set the type parameter, no class or icon will be set.

Type Parameter Example Usage Icon Resulting Style
info {{{messagebox}}}

{{{messagebox|type=info}}}

Information icon.png
Information icon.png The "info" type is the default and will be used if you do not set the type parameter. It's intended for general notices.
question {{{messagebox|type=question}}} Question icon.png
Question icon.png The "question" type should be used when there is uncertainty about the content of an article.
warning {{{messagebox|type=warning}}} Warning icon orange.png
Warning icon orange.png The "warning" type should be used for non-critical warnings.
warning-orange {{{messagebox|type=warning-orange}}} Warning icon orange.png
Warning icon orange.png The "warning-orange" type is a synonym for "warning".
warning-red {{{messagebox|type=warning-red}}} Warning icon.png
Warning icon.png The "warning-red" type should be used only for critical warnings.
error {{{messagebox|type=error}}} Error icon.png
Error icon.png The "error" type should be used only for errors in the wiki itself. We shouldn't need this. ;)
stop {{{messagebox|type=stop}}} Stop sign.png
Stop sign.png The "stop" type gives critical information that should give users pause before they go ahead using a wiki feature or scripting technique.
copyleft {{{messagebox|type=copyleft}}} Copyleft icon.png
Copyleft icon.png The "copyleft" type notes that content is used under a copyleft license. This isn't needed on most pages, since the NWN Lexicon:Copyrights page takes care of most issues here.
copyright {{{messagebox|type=copyright}}} Copyright icon.png
nocopyright {{{messagebox|type=nocopyright}}} No copyright icon.png
No copyright icon.png The "nocopyright" type notes that there is no copyright governing proper use of the content.
none {{{messagebox|type=none}}}
The "none" type yields a message box with no image or special styling. You can still set an image using the image parameter (see below).

image

You can replace the default icon with something else (or set an icon, if using type=none) using the image parameter. There are two ways to do this.

Using a default icon

To use one of the default icons shown above, set the image parameter to the type that yields that icon. For instance, to use the copyright icon without applying the copyright styles to the messagebox, use the following:

{{messagebox|image=copyright| {{lorem ipsum}} }}

This produces:

Copyright icon.png Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Using a custom icon

To use a custom icon, set the image parameter to the wikicode that would normally produce that image. (Note: using this method, you can set the image size to whatever you'd like. You will also need to set the link parameter to empty unless you want readers to be able to click on your new icon.) For example:

{{messagebox|type=warning|image=[[Image:File.png|50px|link=]]| {{lorem ipsum}} }}

This produces:

File.png Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

See the Icons category for more icons.

class

The "class" parameter can be used to add one or more CSS classes to the box. For example, mb-fullwidth will make the box 100% wide instead of 80%.

Multiple classes should be separated by whitespace.

class resulting style
mb-fullwidth
Information icon.png This messagebox taxes up 100% of the available space.
mb-centered
Information icon.png The content of this messagebox will be centered.
mb-autowidth
Information icon.png This messagebox will be the minimum width required to contain its content.
mb-nomargin mb-autowidth
Information icon.png This messagebox combines two CSS classes to be left-aligned and the minimum width necessary to contain its content.

style

The "style" parameter can be used to add arbitrary CSS styling to the messagebox that cannot be added using any of the above parameters. For example, to make the messagebox border purple, use the following code:

{{messagebox|style=border:medium solid purple;|I'm a messagebox with a purple border!}}

This produces:

Information icon.png I'm a messagebox with a purple border!

Nesting

You can use a messagebox within the text part of a messagebox. The nested messagebox will automatically be shrunk, its borders will be removed, and a separator line will be added between the messages.

{{messagebox|type=info|This is information text.{{messagebox|type=warning|This is warning text.}}}}

This produces:

Information icon.png This is information text.
Warning icon orange.png This is warning text.

Note: nested messageboxes look better if you increase the size of the parent messagebox's image to 50px:

{{messagebox|image=[[Image:Information icon.png|50px|link=]]|This is information text.{{messagebox|type=warning|This is warning text.}}}}

This produces:

Information icon.png This is information text.
Warning icon orange.png This is warning text.