Template:Messagebox/doc: Difference between revisions

From Freephile Wiki
No edit summary
remove CSS example
Line 72: Line 72:
The parser code (how to do switch statements) is based on the example of the Ambox template from Mediawiki
The parser code (how to do switch statements) is based on the example of the Ambox template from Mediawiki


The CSS is added to {{PAGENAME}}/styles.css to make this template complete by incorporating the TemplateStyles extension.
The CSS is added to [[Template:Messagebox/styles.css]] to make this template complete by incorporating the TemplateStyles extension.


<syntaxhighlight lang="css">
.message-box {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
background-color:#EBFFEA;
border:1px solid #0BD200;
color:#333333;
padding:8px;
margin:10px;
background-repeat: no-repeat;
background-position: 6px 6px;
}
.message-box a:link, .message-box a:active, .message-box a:visited {
color:#990000;
text-decoration:none;
border-bottom:1px solid #cccccc;
}
.message-box a:hover {
color:#990000;
text-decoration:none;
border-bottom:1px solid #990000;
}
.message-success {
font-weight: bold;
border:1px solid #8FD500;
background-color:#F2FFD7;
padding-left: 32px;
}
.message-failure {
font-weight: bold;
color: #990000;
border:1px solid #DD3C10;
background-color:#FFEBE8;
padding-left: 32px;
}
.message-warning {
font-weight: bold;
color:#FF6633;
border: 1px solid #ff9900;
background-color:#fbf8c7;
padding-left: 32px;
}
.message-box .message-normal {
font-weight:normal;
color: #333;
padding-left: 32px;
}
</syntaxhighlight>
[[Category:Templates using ParserFunctions]]
[[Category:Templates using ParserFunctions]]

Revision as of 06:15, 4 September 2025

This template is for generating nicely formatted message boxes in articles, or even other templates.

Usage[edit]

The template takes three named parameters that can be given in any order.

text
(required) is the message
type
(optional) determines the presentation using pre-defined styling. One of
  • success - to indicate what success means
  • warning - to alert the user about preventing problems
  • failure - to dialog about when something fails
  • restricted - shows the keys graphic, to advise of a restricted access area or restricted authoring
  • forbidden - for messages about policies about things you should not do
  • normal (default)
style
(optional) is CSS that will be passed through.

Literal Code Example[edit]

{{Messagebox
| type = success
| style = width:50%;
| text = your message content
}}

For a more complex (up to 80 parameters) template, see the Infobox template Template_talk:Infobox

Visual Examples[edit]

no type, uses default (normal)


Why be normal?


You won!


Do not spit into the wind


You kissed your cousin


You can't do that!


You must be a registered user to create or edit articles. Contact the WikiSysop for an account!


Making this template[edit]

To generate the resized images from svg

The parser code (how to do switch statements) is based on the example of the Ambox template from Mediawiki

The CSS is added to Template:Messagebox/styles.css to make this template complete by incorporating the TemplateStyles extension.