Difference between revisions of "Template:Ombox"

From Game Detectives Wiki
Jump to: navigation, search
[unchecked revision][unchecked revision]
(reverting breakage)
Line 1: Line 1:
<table class="plainlinks ombox 
+
{{#ifeq:{{{small|}}}|yes
ombox-notice " style="">
+
| {{ombox/core
<tr>
+
   | small = yes
<td class="mbox-image">
+
   | type  = {{{type|}}}
  [[Image:Imbox notice.png | 40x40px|link=|alt=]]</td>
+
  | image = {{#if:{{{smallimage|}}}| {{{smallimage}}} | {{{image|}}} }}
<td class="mbox-text" style=""> {{{text}}} </td>
+
  | imageright = {{#if:{{{smallimageright|}}} | {{{smallimageright}}} | {{{imageright|}}} }}
 
+
   | class = {{{class|}}}
</tr>
+
   | style = {{{style|}}}
</table>
+
   | textstyle = {{{textstyle|}}}
 
+
   | text = {{#if:{{{smalltext|}}}| {{{smalltext}}} | {{{text}}} }}
<!-- Sort on namespace --><!--
+
   }}
   Start of green doc box
+
| {{ombox/core
--><div id="template-documentation" class="template-documentation iezoomfix"><!--
+
   | type = {{{type|}}}
  Add the heading at the top of the doc box:
+
   | image = {{{image|}}}
--><div style="padding-bottom: 3px; border-bottom: 1px solid #aaa; margin-bottom: 1ex;"><!--Add the [edit][purge] or [create] links-->
+
  | imageright = {{{imageright|}}}  
    <span class="editsection plainlinks" id="doc_editlinks">[[//www.mediawiki.org/w/index.php?title=Template:Ombox/doc&action=edit edit]] [<span class="noprint plainlinks purgelink">[//www.mediawiki.org/w/index.php?title=Template:Ombox&action=purge <span title="Purge this page">purge</span>]</span>]</span> <span style="font-weight: bold; font-size: 125%"><!--"heading" not defined in this or previous level-->
+
   | class = {{{class|}}}
    [[Image:Template-info.svg|50px|alt=]] Template documentation</span></div><!--
+
   | style = {{{style|}}}
  Load the /doc content:
+
   | textstyle = {{{textstyle|}}}
  Note: The line breaks between this comment and the if-case
+
  | text = {{{text}}}
  and between the if-case and the following div are necessary so
+
  }}
   "=== Headings ===" at the start and end of docs are interpreted.
+
}}<noinclude>{{documentation}}<!-- Add categories and interwikis to the /doc subpage, not here! --></noinclude>
-->
 
<!-- if not on a /doc subpage, do nothing -->
 
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->
 
<table class="nmbox" style="border:1px solid #AAAAAA; border-collapse:collapse; clear:both; font-size:85%; margin: 0.5em 0;">
 
<tr style="background: #EEF3E2">
 
<th class="mbox-image" style="white-space: nowrap; padding: 4px 1em; border-right: 1px solid #aaaaaa;">[[File:Template-info.svg|50px]] [[Template:Mbox|Message box templates]]</th>
 
<td class="mbox-text" style="background: #F6F9ED;"><tt><nowiki>{{</nowiki>[[Template:ambox|ambox]]<!--
 
--><!--
 
--><!--
 
--><!--
 
--><!--
 
--><nowiki>}}</nowiki></tt> &bull; <tt><nowiki>{{</nowiki>[[Template:tmbox|tmbox]]<!--
 
--><!--
 
--><!--
 
--><!--
 
--><!--
 
--><nowiki>}}</nowiki></tt> &bull; <tt><nowiki>{{</nowiki>[[Template:imbox|imbox]]<!--
 
--><!--
 
--><!--
 
--><!--
 
--><!--
 
--><nowiki>}}</nowiki></tt> &bull; <tt><nowiki>{{</nowiki>[[Template:cmbox|cmbox]]<!--
 
--><!--
 
--><!--
 
--><!--
 
--><!--
 
--><nowiki>}}</nowiki></tt> &bull; <tt><nowiki>{{</nowiki>[[Template:ombox|ombox]]<!--
 
--><!--
 
--><!--
 
--><!--
 
--><!--
 
--><nowiki>}}</nowiki></tt></td>
 
</tr></table>
 
This is the <tt><nowiki>{{</nowiki>[[Template:ombox|ombox]]<!--
 
--><!--
 
--><!--
 
--><!--
 
--><!--
 
--><nowiki>}}</nowiki></tt> or '''other pages message box''' meta-template.
 
 
 
It is used to build message box templates for pages of the types: User, Wikipedia, MediaWiki, Template, Help, Portal and any new future namespaces. That is, page types not covered by <tt><nowiki>{{</nowiki>[[Template:ambox|ambox]]<!--
 
--><!--
 
--><!--
 
--><!--
 
--><!--
 
--><nowiki>}}</nowiki></tt>, <tt><nowiki>{{</nowiki>[[Template:tmbox|tmbox]]<!--
 
--><!--
 
--><!--
 
--><!--
 
--><!--
 
--><nowiki>}}</nowiki></tt>, <tt><nowiki>{{</nowiki>[[Template:imbox|imbox]]<!--
 
--><!--
 
--><!--
 
--><!--
 
--><!--
 
--><nowiki>}}</nowiki></tt> or <tt><nowiki>{{</nowiki>[[Template:cmbox|cmbox]]<!--
 
--><!--
 
--><!--
 
--><!--
 
--><!--
 
--><nowiki>}}</nowiki></tt>. Thus, it should ''not'' be used for boxes for articles, talk pages, image pages or category pages.
 
 
 
This template works almost exactly like <tt><nowiki>{{</nowiki>[[Template:ambox|ambox]]<!--
 
--><!--
 
--><!--
 
--><!--
 
--><!--
 
--><nowiki>}}</nowiki></tt> and uses the same parameters.
 
 
 
=== Usage ===
 
Simple usage example:
 
 
 
<pre>
 
{{ombox | text = Some text.}}
 
</pre>
 
 
 
<table class="plainlinks ombox 
 
ombox-notice " style="">
 
<tr>
 
<td class="mbox-image">
 
   [[Image:Imbox notice.png | 40x40px|link=|alt=]]</td>
 
<td class="mbox-text" style=""> Some text. </td>
 
 
 
</tr>
 
</table><!-- Detect and report usage with faulty "type" parameter:
 
--><div style="text-align: center;">This message box is using an invalid "type=" parameter and needs fixing.</div>[[Category:Wikipedia message box parameter needs fixing|Template:Ombox]]<!-- Sort on namespace -->
 
<div style="clear:both;"></div>
 
 
 
Complex example:
 
 
 
<pre>
 
{{ombox
 
| type      = style
 
| image    = [[Image:Emblem-question-yellow.svg|40px]]
 
| style    = width: 400px;
 
| textstyle = color: red; font-weight: bold; font-style: italic;
 
| text      = The message body text.
 
}}
 
</pre>
 
 
 
<table class="plainlinks ombox 
 
ombox-style " style="width: 400px;">
 
<tr>
 
<td class="mbox-image">
 
   [[Image:Emblem-question-yellow.svg|40px]]</td>
 
<td class="mbox-text" style="color: red; font-weight: bold; font-style: italic;"> The message body text. </td>
 
 
 
</tr>
 
</table><!-- Detect and report usage with faulty "type" parameter:
 
--><!-- Do nothing, valid "type" -->
 
<div style="clear:both;"></div>
 
 
 
=== Other pages message box types ===
 
The following examples use different '''type''' parameters but use no image parameters thus they use the default images for each type.
 
 
 
<table class="plainlinks ombox 
 
ombox-speedy " style="">
 
<tr>
 
<td class="mbox-image">
 
  [[Image:Imbox speedy deletion.png | 40x40px|link=|alt=]]</td>
 
<td class="mbox-text" style=""> type=<u>speedy</u> – Speedy deletion templates. </td>
 
 
 
</tr>
 
</table><!-- Detect and report usage with faulty "type" parameter:
 
--><!-- Do nothing, valid "type" -->
 
<table class="plainlinks ombox 
 
ombox-delete " style="">
 
<tr>
 
<td class="mbox-image">
 
  [[Image:Imbox deletion.png | 40x40px|link=|alt=]]</td>
 
<td class="mbox-text" style=""> type=<u>delete</u> – Deletion templates. </td>
 
 
 
</tr>
 
</table><!-- Detect and report usage with faulty "type" parameter:
 
--><!-- Do nothing, valid "type" -->
 
<table class="plainlinks ombox 
 
ombox-content " style="">
 
<tr>
 
<td class="mbox-image">
 
  [[Image:Imbox content.png | 40x40px|link=|alt=]]</td>
 
<td class="mbox-text" style=""> type=<u>content</u> – Major warnings and problems, such as <tt><nowiki>{{</nowiki>[[Template:high-risk|high-risk]]<!--
 
--><!--
 
--><!--
 
--><!--
 
--><!--
 
--><nowiki>}}</nowiki></tt>. </td>
 
 
 
</tr>
 
</table><!-- Detect and report usage with faulty "type" parameter:
 
--><!-- Do nothing, valid "type" -->
 
<table class="plainlinks ombox 
 
ombox-style " style="">
 
<tr>
 
<td class="mbox-image">
 
   [[Image:Edit-clear.svg | 40x40px|link=|alt=]]</td>
 
<td class="mbox-text" style=""> type=<u>style</u> – Minor warnings and problems. <tt><nowiki>{{</nowiki>[[Template:intricate|intricate]]<!--
 
--><!--
 
--><!--
 
--><!--
 
--><!--
 
--><nowiki>}}</nowiki></tt> should perhaps use this type. </td>
 
 
 
</tr>
 
</table><!-- Detect and report usage with faulty "type" parameter:
 
--><!-- Do nothing, valid "type" -->
 
<table class="plainlinks ombox 
 
ombox-notice " style="">
 
<tr>
 
<td class="mbox-image">
 
   [[Image:Imbox notice.png | 40x40px|link=|alt=]]</td>
 
<td class="mbox-text" style=""> type=<u>notice</u> – Notices and messages of any kind, both permanent and temporary. Such as <tt><nowiki>{{</nowiki>[[Template:guideline|guideline]]<!--
 
--><!--
 
--><!--
 
--><!--
 
--><!--
 
--><nowiki>}}</nowiki></tt> and <tt><nowiki>{{</nowiki>[[Template:Wikipedia how to|Wikipedia how to]]<!--
 
--><!--
 
--><!--
 
--><!--
 
--><!--
 
--><nowiki>}}</nowiki></tt>. </td>
 
 
 
</tr>
 
</table><!-- Detect and report usage with faulty "type" parameter:
 
--><!-- Do nothing, valid "type" -->
 
<table class="plainlinks ombox 
 
ombox-move " style="">
 
<tr>
 
<td class="mbox-image">
 
  [[Image:Imbox move.png | 40x40px|link=|alt=]]</td>
 
<td class="mbox-text" style=""> type=<u>move</u> – Merge, split, rename and transwiki messages and proposals. </td>
 
 
 
</tr>
 
</table><!-- Detect and report usage with faulty "type" parameter:
 
--><!-- Do nothing, valid "type" -->
 
<table class="plainlinks ombox 
 
ombox-protection " style="">
 
<tr>
 
<td class="mbox-image">
 
  [[Image:Imbox protection.png | 40x40px|link=|alt=]]</td>
 
<td class="mbox-text" style=""> type=<u>protection</u> – Protection templates such as <tt><nowiki>{{</nowiki>[[Template:pp-protected|pp-protected]]<!--
 
--><!--
 
--><!--
 
--><!--
 
--><!--
 
--><nowiki>}}</nowiki></tt> when shown on "other pages". </td>
 
 
 
</tr>
 
</table><!-- Detect and report usage with faulty "type" parameter:
 
--><!-- Do nothing, valid "type" -->
 
 
 
=== Examples ===
 
Some examples using the "notice" style:
 
 
 
<table class="plainlinks ombox 
 
ombox-notice " style="">
 
<tr>
 
<td class="mbox-image">
 
   [[Image:Imbox notice.png | 40x40px|link=|alt=]]</td>
 
<td class="mbox-text" style=""> No type and no image given ('''default''') </td>
 
 
 
</tr>
 
</table><!-- Detect and report usage with faulty "type" parameter:
 
--><div style="text-align: center;">This message box is using an invalid "type=" parameter and needs fixing.</div>[[Category:Wikipedia message box parameter needs fixing|Template:Ombox]]<!-- Sort on namespace -->
 
<table class="plainlinks ombox
 
ombox-notice " style="">
 
<tr>
 
<!-- No image. Cell with some width or padding necessary for text cell to have 100% width. --><td class="mbox-empty-cell"></td>
 
<td class="mbox-text" style=""> No type and '''image=none''' – No image is used and the '''text''' uses the whole message box area. </td>
 
 
 
</tr>
 
</table><!-- Detect and report usage with faulty "type" parameter:
 
--><div style="text-align: center;">This message box is using an invalid "type=" parameter and needs fixing.</div>[[Category:Wikipedia message box parameter needs fixing|Template:Ombox]]<!-- Sort on namespace -->
 
<table class="plainlinks ombox 
 
ombox-notice " style="">
 
<tr>
 
<td class="mbox-image">
 
   [[Image:Gnome globe current event.svg|42px]]</td>
 
<td class="mbox-text" style=""> image = <nowiki>[[Image:Gnome globe current event.svg|42px]]</nowiki> <br> imageright = <nowiki>[[Image:Nuvola apps bookcase.svg|40px]]</nowiki> </td>
 
<td class="mbox-imageright"> [[Image:Nuvola apps bookcase.svg|40px]] </td>
 
</tr>
 
</table><!-- Detect and report usage with faulty "type" parameter:
 
--><div style="text-align: center;">This message box is using an invalid "type=" parameter and needs fixing.</div>[[Category:Wikipedia message box parameter needs fixing|Template:Ombox]]<!-- Sort on namespace -->
 
 
 
<table class="plainlinks ombox 
 
ombox-notice " style="">
 
<tr>
 
<td class="mbox-image">
 
   [[Image:Blue check.svg|30px]]</td>
 
<td class="mbox-text" style=""> '''This page documents an English Wikipedia [[Wikipedia:Policies and guidelines|guideline]].''' It is a generally accepted standard that editors should follow, though it should be treated with [[Wikipedia:Use common sense|common sense]] and the [[Wikipedia:Ignore all rules|occasional exception]]. When editing this page, please ensure that your revision reflects [[Wikipedia:Consensus|consensus]]. When in doubt, discuss on the [[Template talk:Ombox|talk page]]. </td>
 
<td class="mbox-imageright"> <div style="float: right; clear: right; margin: 0 0 0.5em 0.5em; background-color: #ccff99; ; padding: 5px 8px; -moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px; font-size: 85%;; text-align: center;">shortcut: [[WP:SHORT|'''WP:SHORT''']]</div> </td>
 
</tr>
 
</table><!-- Detect and report usage with faulty "type" parameter:
 
--><!-- Do nothing, valid "type" -->
 
<table class="plainlinks ombox 
 
ombox-notice " style="">
 
<tr>
 
<td class="mbox-image">
 
  [[Image:Nutshell.png|30px]]</td>
 
<td class="mbox-text" style=""> '''This page in a nutshell:''' This template is used to build message boxes for all pages that are ''not'' articles, talk pages, image pages or category pages. </td>
 
 
 
</tr>
 
</table><!-- Detect and report usage with faulty "type" parameter:
 
--><!-- Do nothing, valid "type" -->
 
 
 
=== Parameters ===
 
List of all parameters:
 
 
 
<pre>
 
{{ombox
 
| type  = speedy / delete / content / style / notice / move / protection
 
| image = none / [[Image:Some image.svg|40px]]
 
| imageright = [[Image:Some image.svg|40px]]
 
| style = CSS values
 
| textstyle = CSS values
 
| text  = The message body text.
 
| small = {{{small|}}} / yes
 
| smallimage = none / [[Image:Some image.svg|30px]]
 
| smallimageright = none / [[Image:Some image.svg|30px]]
 
| smalltext  = A shorter message body text.
 
}}
 
</pre>
 
 
 
'''type'''
 
:If no '''type''' parameter is given the template defaults to type '''notice'''. That means it gets a gray border.
 
 
 
'''image'''
 
:'''No parameter''' = If no '''image''' parameter is given the template uses a default image. Which default image it uses depends on the '''type''' parameter.
 
:'''An image''' = Should be an image with usual wiki notation. 40px - 50px width are usually about right depending on the image height to width ratio. (But the message box can handle images of any size.) For example:
 
::<code><nowiki>image = [[Image:Crystal package settings.png|40px]]</nowiki></code>
 
:'''none''' = Means that no image is used.
 
 
 
'''imageright'''
 
:'''No parameter''' = If no '''imageright''' parameter is given then no image is shown on the right side.
 
:'''An image''' = Should be an image with usual wiki notation. 40px - 50px width are usually about right depending on the image height to width ratio. (But the message box can handle images of any size.) For example:
 
::<code><nowiki>imageright = [[Image:Nuvola apps bookcase.png|40px]]</nowiki></code>
 
:'''Anything''' = Any other object that you want to show on the right side.
 
 
 
'''style'''
 
:Optional [[Cascading Style Sheets|CSS]] values used by the entire message box table. Without quotation marks <code>" "</code> but with the ending semicolons <code>;</code>. For example:
 
::<code>style = margin-bottom: 0.5em;</code>
 
 
 
'''textstyle'''
 
:Optional [[Cascading Style Sheets|CSS]] values used by the text cell. For example:
 
::<code>textstyle = text-align: center;</code>
 
 
 
'''text'''
 
:The message body text.
 
 
 
==== The small parameters ====
 
<table class="plainlinks ombox mbox-small
 
ombox-notice " style="">
 
<tr>
 
<td class="mbox-image">
 
  [[Image:Imbox notice.png | 30x30px|link=|alt=]]</td>
 
<td class="mbox-text" style=""> small = yes </td>
 
 
 
</tr>
 
</table><!-- Detect and report usage with faulty "type" parameter:
 
--><div style="text-align: center;">This message box is using an invalid "type=" parameter and needs fixing.</div>[[Category:Wikipedia message box parameter needs fixing|Template:Ombox]]<!-- Sort on namespace -->
 
<table class="plainlinks ombox mbox-small
 
ombox-style " style="">
 
<tr>
 
<td class="mbox-image">
 
   [[Image:Edit-clear.svg | 30x30px|link=|alt=]]</td>
 
<td class="mbox-text" style=""> type = style <br> small = yes </td>
 
 
 
</tr>
 
</table><!-- Detect and report usage with faulty "type" parameter:
 
--><!-- Do nothing, valid "type" -->
 
'''small'''
 
:'''yes''' = Makes it a smaller right floating message box. This also makes the default images smaller. Note that any data fed to the '''smallimage''', '''smallimageright''' and '''smalltext''' parameters is only used if "small=yes". To make it so your template also understands the small parameter you can use this code:
 
::<code><nowiki>small = {{{small|}}}</nowiki></code>
 
 
 
<table class="plainlinks ombox mbox-small
 
ombox-notice " style="">
 
<tr>
 
<td class="mbox-image">
 
  [[Image:Replacement filing cabinet.svg|32px]]</td>
 
<td class="mbox-text" style=""> small = yes <br> image = <nowiki>[[Image:Replacement filing cabinet.svg|50px]]</nowiki> <br> smallimage = <nowiki>[[Image:Replacement filing cabinet.svg|32px]]</nowiki> </td>
 
 
 
</tr>
 
</table><!-- Detect and report usage with faulty "type" parameter:
 
--><div style="text-align: center;">This message box is using an invalid "type=" parameter and needs fixing.</div>[[Category:Wikipedia message box parameter needs fixing|Template:Ombox]]<!-- Sort on namespace -->
 
'''smallimage'''
 
:'''No parameter''' = If no '''smallimage''' parameter is given then this template falls back to use the '''image''' parameter. If the '''image''' parameter also is empty then a small default image is used.
 
:'''An image''' = Should be an image with usual wiki notation. 30px width is usually about right. For example:
 
::<code><nowiki>smallimage = [[Image:Replacement filing cabinet.svg|30px]]</nowiki></code>
 
:'''none''' = Means that no image is used. This overrides any image fed to '''image''', when "small=yes".
 
 
 
<table class="plainlinks ombox mbox-small
 
ombox-notice " style="">
 
<tr>
 
<td class="mbox-image">
 
   [[Image:Imbox notice.png | 30x30px|link=|alt=]]</td>
 
<td class="mbox-text" style=""> small = yes <br> imageright = <nowiki>[[Image:Nuvola apps bookcase.png|50px]]</nowiki> <br> smallimageright = none </td>
 
<!-- No image. -->
 
</tr>
 
</table><!-- Detect and report usage with faulty "type" parameter:
 
--><div style="text-align: center;">This message box is using an invalid "type=" parameter and needs fixing.</div>[[Category:Wikipedia message box parameter needs fixing|Template:Ombox]]<!-- Sort on namespace -->
 
'''smallimageright'''
 
:'''No parameter''' = If no '''smallimageright''' parameter is given then this template falls back to use the '''imageright''' parameter. If the '''imageright''' parameter also is empty then no image is shown on the right side.
 
:'''An image''' = Should be an image with usual wiki notation. 30px width is usually about right. For example:
 
::<code><nowiki>smallimageright = [[Image:Nuvola apps bookcase.png|30px]]</nowiki></code>
 
:'''Anything''' = Any other object that you want to show on the right side.
 
:'''none''' = Means that no right side image is used. This overrides any image fed to '''imageright''', when "small=yes".
 
 
 
'''smalltext'''
 
:A shorter version of the message body text. If no '''smalltext''' parameter is given then this template falls back to use the '''text''' parameter.
 
 
 
=== Technical details ===
 
If you need to use special characters in the text parameter then you need to escape them like this:
 
 
 
<pre>
 
{{ombox
 
| text  = <div>
 
Equal sign = and a start and end brace { } work fine as they are.
 
But here is a pipe {{!}} and two end braces &lt;nowiki>}}&lt;/nowiki>.
 
And now a pipe and end braces &lt;nowiki>|}}&lt;/nowiki>.
 
</div>
 
}}
 
</pre>
 
 
 
<table class="plainlinks ombox 
 
ombox-notice " style="">
 
<tr>
 
<td class="mbox-image">
 
   [[Image:Imbox notice.png | 40x40px|link=|alt=]]</td>
 
<td class="mbox-text" style=""> <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> </td>
 
 
 
</tr>
 
</table><!-- Detect and report usage with faulty "type" parameter:
 
--><div style="text-align: center;">This message box is using an invalid "type=" parameter and needs fixing.</div>[[Category:Wikipedia message box parameter needs fixing|Template:Ombox]]<!-- Sort on namespace -->
 
 
 
This template uses the ombox CSS classes in [[MediaWiki:Common.css]] for most of its looks, thus it is fully skinnable.
 
 
 
This template calls <tt><nowiki>{{</nowiki>[[Template:ombox/core|ombox/core]]<!--
 
--><!--
 
--><!--
 
--><!--
 
--><!--
 
--><nowiki>}}</nowiki></tt> which holds most of the code for <tt><nowiki>{{</nowiki>[[Template:ombox|ombox]]<!--
 
--><!--
 
--><!--
 
--><!--
 
--><!--
 
--><nowiki>}}</nowiki></tt>, while <tt><nowiki>{{</nowiki>[[Template:ombox|ombox]]<!--
 
--><!--
 
--><!--
 
--><!--
 
--><!--
 
--><nowiki>}}</nowiki></tt> itself does parameter preprocessing.
 
 
 
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 [[m:Help:ParserFunctions|parser functions]] and special characters in parameters.
 
 
 
The default images for this meta-template are in png format instead of svg format. The main reason is that some older web browsers have trouble with the transparent background that MediaWiki renders for svg images. The png images here have hand optimised transparent background colour so they look good in all browsers. Note that svg icons only look somewhat bad in the old browsers, thus such hand optimisation is only worth the trouble for very widely used icons.
 
 
 
For more technical details see the [[Template talk:Ombox|talk page]]. Since this template works almost exactly like <tt><nowiki>{{</nowiki>[[Template:ambox|ambox]]<!--
 
--><!--
 
--><!--
 
--><!--
 
--><!--
 
--><nowiki>}}</nowiki></tt>, <tt><nowiki>{{</nowiki>[[Template:tmbox|tmbox]]<!--
 
--><!--
 
--><!--
 
--><!--
 
--><!--
 
--><nowiki>}}</nowiki></tt>, <tt><nowiki>{{</nowiki>[[Template:imbox|imbox]]<!--
 
--><!--
 
--><!--
 
--><!--
 
--><!--
 
--><nowiki>}}</nowiki></tt> and <tt><nowiki>{{</nowiki>[[Template:cmbox|cmbox]]<!--
 
--><!--
 
--><!--
 
--><!--
 
--><!--
 
--><nowiki>}}</nowiki></tt> their talk pages and related pages might also contain more details.
 
 
 
=== See also ===
 
*[[w:Template:Ombox]]
 
 
 
 
 
[[Category:Mbox templates|Ombox]]
 
<div style="clear: both;"></div><!--So right or left floating items don't stick out of the doc box.-->
 
</div><!--End of green doc box--><!--
 
  Link box below for the doc meta-data:
 
--><table id="documentation-meta-data" class="plainlinks fmbox
 
fmbox-system " style="background-color: #ecfcf4; width: 100%;">
 
<tr>
 
<!-- No image. -->
 
<td class="mbox-text" style="font-style: italic;"> <!--/doc exists, link to it-->
 
        The above [[w:Wikipedia:Template documentation|documentation]] is [[w:Wikipedia:Transclusion|transcluded]] from [[Template:Ombox/doc]]. <small style="font-style: normal">([//www.mediawiki.org/w/index.php?title=Template:Ombox/doc&action=edit edit] &#124; [//www.mediawiki.org/w/index.php?title=Template:Ombox/doc&action=history history])</small> <br><!--
 
        Add links to /sandbox and /testcases when appropriate:
 
  -->Editors can experiment in this template's sandbox <small style="font-style: normal">([//www.mediawiki.org/w/index.php?title=Template:Ombox/sandbox&action=edit&preload=Template:Documentation/preload-sandbox create])</small> and testcases <small style="font-style: normal">([//www.mediawiki.org/w/index.php?title=Template:Ombox/testcases&action=edit&preload=Template:Documentation/preload-testcases create])</small> pages. <br><!--
 
        Show the cats and interwiki text, but not
 
        if "content" fed or "docname fed" since then it is
 
        unclear where to add the cats and interwikis.
 
  -->Please add categories and interwikis to the [[Template:Ombox/doc|/doc]] subpage.<!--
 
        Show the "Subpages" link:
 
  -->&#32;[[Special:PrefixIndex/Template:Ombox/|Subpages of this template]]. </td>
 
 
 
</tr>
 
</table><!--
 
  Detect and report usage with faulty "type" parameter:
 
--><div style="text-align: center;">This message box is using an invalid "type=" parameter and needs fixing.</div>[[Category:Wikipedia message box parameter needs fixing|Template:Ombox]]<!-- Sort on namespace --><!--End link box--><!--
 
 
 
  Detect and report strange usage:
 
-->[[Category:Wikipedia pages with strange ((documentation)) usage|Template:Ombox]]<!-- Sort on namespace --><!--End of green doc box--><!-- Add categories and interwikis to the /doc subpage, not here! -->
 

Revision as of 22:39, 25 January 2013

Template:Ombox/core<templatestyles src="Module:Documentation/styles.css"></templatestyles>
Template documentation[view] [edit] [history] [purge]

This is the {{Ombox}} ([O]ther pages [m]essage [box]) metatemplate.

It is used to build message box templates for pages of the types User, Wikipedia, MediaWiki, Template, Help, Portal and any new future namespaces; i.e. for page types not covered by {{Ambox}}, {{Tmbox}}, {{Imbox}} or {{Cmbox}}. Thus, it should not be used for boxes for articles, talk pages, image pages or category pages.

This template works almost exactly like {{Ambox}} and uses the same parameters.

Description

As noted above, this template should be used for message boxes that are not articles, talk pages, image pages or category pages. Some message boxes for other pages may incorrectly use one of those four mentioned. Feel free to convert any message boxes used on "other pages" to use this meta-template. If you find any tricky cases then list them on the talk page of this template and you'll get help.

When this template is used to build other pages message boxes those boxes should contain explanatory texts just like before. (The same texts as before or new improved texts.) If there are more specific images in the boxes or you know a better image, then use them instead of the default images shown here.

Usage

Simple usage example:

{{ombox | text = Some text.}}

Complex example:

{{ombox
| type      = style
| image     = [[Image:Emblem-question-yellow.svg|40px]]
| style     = width: 400px; 
| textstyle = color: red; font-weight: bold; font-style: italic;
| text      = The message body text.
}}
Other pages message box types

The following examples use different type parameters but use no image parameters; thus, they use the default images for each type.


Examples Some examples using the "notice" style:


Parameters

List of all parameters:

{{ombox
| type  = speedy / delete / content / style / notice / move / protection
| image = none / [[Image:Some image.svg|40px]]
| imageright = [[Image:Some image.svg|40px]]
| style = CSS values
| textstyle = CSS values
| text  = The message body text. 
| small = {{{small|}}} / yes
| smallimage = none / [[Image:Some image.svg|30px]]
| smallimageright = none / [[Image:Some image.svg|30px]]
| smalltext  = A shorter message body text.
}}

type

If no type parameter is given the template defaults to type notice. That means it gets a gray border.

image

No parameter = If no image parameter is given the template uses a default image. Which default image it uses depends on the type parameter.
An image = Should be an image with usual wiki notation. 40px - 50px width are usually about right depending on the image height to width ratio. (But the message box can handle images of any size.) For example:
image = [[Image:Crystal package settings.png|40px]]
none = Means that no image is used.

imageright

No parameter = If no imageright parameter is given then no image is shown on the right side.
An image = Should be an image with usual wiki notation. 40px - 50px width are usually about right depending on the image height to width ratio. (But the message box can handle images of any size.) For example:
imageright = [[Image:Nuvola apps bookcase.png|40px]]
Anything = Any other object that you want to show on the right side.

style

Optional CSS values used by the entire message box table. Without quotation marks " " but with the ending semicolons ;. For example:
style = margin-bottom: 0.5em;

textstyle

Optional CSS values used by the text cell. For example:
textstyle = text-align: center;

text

The message body text.
The small parameters

small

yes = Makes it a smaller right floating message box. This also makes the default images smaller. Note that any data fed to the smallimage, smallimageright and smalltext parameters is only used if "small=yes". To make it so your template also understands the small parameter you can use this code:
small = {{{small|}}}

smallimage

No parameter = If no smallimage parameter is given then this template falls back to use the image parameter. If the image parameter also is empty then a small default image is used.
An image = Should be an image with usual wiki notation. 30px width is usually about right. For example:
smallimage = [[Image:Replacement filing cabinet.svg|30px]]
none = Means that no image is used. This overrides any image fed to image, when "small=yes".

smallimageright

No parameter = If no smallimageright parameter is given then this template falls back to use the imageright parameter. If the imageright parameter also is empty then no image is shown on the right side.
An image = Should be an image with usual wiki notation. 30px width is usually about right. For example:
smallimageright = [[Image:Nuvola apps bookcase.png|30px]]
Anything = Any other object that you want to show on the right side.
none = Means that no right side image is used. This overrides any image fed to imageright, when "small=yes".

smalltext

A shorter version of the message body text. If no smalltext parameter is given then this template falls back to use the text parameter.
Technical details

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

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

This template uses the ombox CSS classes in MediaWiki:Common.css for most of its looks, thus it is fully skinnable.

This template calls {{ombox/core}} which holds most of the code for {{ombox}}, while {{ombox}} itself does parameter preprocessing.

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.

The default images for this meta-template are in png format instead of svg format. The main reason is that some older web browsers have trouble with the transparent background that MediaWiki renders for svg images. The png images here have hand optimised transparent background colour so they look good in all browsers. Note that svg icons only look somewhat bad in the old browsers, thus such hand optimisation is only worth the trouble for very widely used icons.

For more technical details see the talk page. Since this template works almost exactly like {{ambox}}, {{tmbox}}, {{imbox}} and {{cmbox}} their talk pages and related pages might also contain more details.

See also