Messagebox – Template

From Bohemia Interactive Community
Jump to navigation Jump to search
(Fix the line return issue for lists - nice trick, thanks https://www.mediawiki.org/wiki/Extension:ParserFunctions/String_functions##replace (nowiki/ twice instead of nowiki /nowiki))
(Add class setting)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
<includeonly><div class="biki-messagebox" style="background-color:{{{3|#025D00}}}"><!--
<includeonly><div class="biki-messagebox{{#if:{{{class|}}}|<nowiki/> {{{class}}}}}" style="background-color:{{{3|#025D00}}}"><!--
--><div>{{{2|i}}}</div><!--
--><div>{{{2|i}}}</div><!--
--><div>{{#if:{{Trim|{{{1|}}}}}|{{Trim|{{#replace:{{#replace:{{{1|}}}|<nowiki/>
--><div>{{#if:{{Trim|{{{1|}}}}}|{{Trim|{{{1|}}}}}|-Text not defined-}}</div><!--
 
<nowiki/>|<br>}}|<nowiki/>
<nowiki/>|<nowiki/> <nowiki/>}}}}|-Text not defined-}}</div><!--
--></div></includeonly><noinclude>Displays a standardised message box.
--></div></includeonly><noinclude>Displays a standardised message box.
Base of messageboxes, used by <span class="plainlinks">[{{SERVER}}/wiki?title=Special%3AWhatLinksHere&target=Template%3AMessagebox&namespace=10 many other templates]</span>.
Base of messageboxes, used by <span class="plainlinks">[{{SERVER}}/wiki?title=Special%3AWhatLinksHere&target=Template%3AMessagebox&namespace=10 many other templates]</span>.


== Usage ==
== Usage ==
{{<nowiki/>Messagebox|'''''message'''''|'''''icon'''''|'''''colour'''''}}
{{<nowiki/>Messagebox|'''''message'''''|'''''icon'''''|'''''colour'''''|'''''class='''''}}
* message: the message to display
* message: the message to display
* icon: (Optional, default "i") symbol to the left, a letter (written in white) or an image (format {{hl|[[<nowiki/>File]])
* icon: (Optional, default "i") symbol to the left, a letter (written in white) or an image (format {{hl|[[<nowiki/>File]])
Line 19: Line 16:
** hsl format - '''hsl(120, 100%, 50%)'''
** hsl format - '''hsl(120, 100%, 50%)'''
** hsla format - '''hsla(120, 60%, 70%, 0.3)'''
** hsla format - '''hsla(120, 60%, 70%, 0.3)'''
* class: (Optional, default none) makes it possible to add a CSS class


{| class="wikitable"
{| class="wikitable"
Line 57: Line 55:
* First
* First
: {{Feature|informative|indented}}
: {{Feature|informative|indented}}
: {{Feature|informative|indented
: {{Feature|informative| {{GVI|arma3}}indented
two lines}}
two lines}}
* {{Feature|informative|Second,
* {{Feature|informative|Second,
Line 69: Line 67:
double line return}}
double line return}}
* Last
* Last
{{Feature|informative|After}}
{{Feature|informative|
* After 1
* After 2
}}
</pre>
</pre>
|
|
Line 75: Line 76:
* First
* First
: {{Feature|informative|indented}}
: {{Feature|informative|indented}}
: {{Feature|informative|indented
: {{Feature|informative| {{GVI|arma3}}indented
two lines}}
two lines}}
* {{Feature|informative|Second,
* {{Feature|informative|Second,
Line 87: Line 88:
double line return}}
double line return}}
* Last
* Last
{{Feature|informative|After}}
{{Feature|informative|
* After 1
* After 2
}}
|-
|-
| <nowiki>{{Messagebox|Yep|Unreadable!|#EEE}}</nowiki>
| <nowiki>{{Messagebox|Yep|Unreadable!|#EEE}}</nowiki>
Line 113: Line 117:
== Source ==
== Source ==
<syntaxhighlight lang="html">
<syntaxhighlight lang="html">
<div class="biki-messagebox" style="background-color:{{{3|#025D00}}}"><!--
<div class="biki-messagebox{{#if:{{{class|}}}|<nowiki/> {{{class}}}}}" style="background-color:{{{3|#025D00}}}"><!--
--><div>{{{2|i}}}</div><!--
--><div>{{{2|i}}}</div><!--
--><div>{{#if:{{Trim|{{{1|}}}}}|{{Trim|{{#replace:{{#replace:{{{1|}}}|<nowiki/>
--><div>{{#if:{{Trim|{{{1|}}}}}|{{Trim|{{{1|}}}}}|-Text not defined-}}</div><!--
 
<nowiki/>|<br>}}|<nowiki/>
<nowiki/>|<nowiki/> <nowiki/>}}}}|-Text not defined-}}</div><!--
--></div>
--></div>
</syntaxhighlight>
</syntaxhighlight>

Latest revision as of 19:02, 5 February 2024

Displays a standardised message box. Base of messageboxes, used by many other templates.

Usage

{{Messagebox|message|icon|colour|class=}}

  • message: the message to display
  • icon: (Optional, default "i") symbol to the left, a letter (written in white) or an image (format {{hl|[[File]])
  • colour: (Optional, default #025D00) box HTML colour, can be one of:
    • HTML colour name - red, darkgrey, etc.
    • HTML colour format - #RGB or #RRGGBB
    • rgb format - rgb(255, 0, 0)
    • rgba format - rgba(255, 0, 0, 0.5)
    • hsl format - hsl(120, 100%, 50%)
    • hsla format - hsla(120, 60%, 70%, 0.3)
  • class: (Optional, default none) makes it possible to add a CSS class
Examples
Code Result
{{Messagebox}}
i
-Text not defined-
{{Messagebox|Hello there!}}
i
Hello there!
{{Messagebox|Hello there!|✔}}
Hello there!
{{Messagebox|Hello there!|✔|orange}}
Hello there!
{{Messagebox|Hello there!|✔|#CDF}}
Hello there!
{{Messagebox|Text:
Hello there!
General Kenobi!
}}
i
Text:

Hello there!

General Kenobi!
{{Messagebox|Text:
Hello there!

General Kenobi!
}}
i
Text:

Hello there!

General Kenobi!
{{Feature|informative|Before}}
* First
: {{Feature|informative|indented}}
: {{Feature|informative| {{GVI|arma3}}indented
two lines}}
* {{Feature|informative|Second,
line return,

double line return}}
* {{Feature|informative|
Third,
line return,

double line return}}
* Last
{{Feature|informative|
* After 1
* After 2
}}
Before
  • First
indented
Arma 3 logo black.png?indented
two lines
  • Second,

line return,

double line return
  • Third,

line return,

double line return
  • Last
  • After 1
  • After 2
{{Messagebox|Yep|Unreadable!|#EEE}}
Unreadable!
Yep
{{Messagebox|{{arma3}} logo|[[File:Arma 3_logo_black.png|300px|center]]|#888}}
Arma 3 logo black.png
Arma 3 logo
{{Messagebox|[[File:Arma 3_logo_black.png|300px|center]]|{{arma3}} logo|#333}}
Arma 3 logo
Arma 3 logo black.png
{{Messagebox|{{ofp}}<br>{{arma1}}<br>{{arma2}}<br>{{arma3}}|A|#333}}
A
Operation Flashpoint
Armed Assault
Arma 2
Arma 3
{{Messagebox|{{arma3}}|a<br>b<br>c<br>d|#333}}
a
b
c
d
Arma 3
{{Messagebox|One line text|{{arma3}}|#FDA}}
Arma 3
One line text
{{Messagebox|{{Wiki|lorem}}|{{arma3}}|#FDA}}
Arma 3
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.

Source

<div class="biki-messagebox{{#if:{{{class|}}}|<nowiki/> {{{class}}}}}" style="background-color:{{{3|#025D00}}}"><!--
--><div>{{{2|i}}}</div><!--
--><div>{{#if:{{Trim|{{{1|}}}}}|{{Trim|{{{1|}}}}}|-Text not defined-}}</div><!--
--></div>