User:WikiWriter/Sandbox/Alertboxes
MediaWiki templates can use other templates - this allows common elements of any template to be hidden in a general-purpose template that can be used by a special-purpose template.
alert_box_80
[edit]The general-purpose template used for alert-boxes is the alert_box_80 template - the '80' being a reference to the fact that it takes up 80% of the page width - the following markup shows the template is a simple two-cell table requiring 3 parameters for customisation.
{| width=80% align=center cellpadding=2 style="margin:2px auto 2px auto; border-style:solid; border-color:#9c9cff; border-width:1px; border-left-width:10px; border-left-color:{{{1}}};" | width=50 height:50 style="margin:0px; padding:0px;" | [[image:{{{2}}}]] || valign=top style="padding-left:5px; font-size:10pt; line-height:14pt;" | {{{3}}} |}
In MediaWiki markup - parameters in templates are numbers between triple 'curly brackets' {{{1}}}.
Example - using 'alert_box_80' to create 'page_under_construction'
[edit]The page_under_construction template is a special-purpose template based on the alert_box_80 template. In an KnowledgebaseWiki article - the 'page_under_construction' appears as : {{page_under_construction}} And its markup appears :
{{alert_box_80|cornflowerblue|Construction-50px.png|'''This [[KnowledgebaseWiki:About|KnowledgebaseWiki]] article is under construction.'''<br>You are welcome to assist in its construction by editing it as well.}}
In the first line you can see the reference to the alert_box_80 template - with its specialising parameters :
- 'cornflowerblue' - being the colour of the left-hand border
- 'construction-50px.png' - being the name of the image used
- 'This KnowledgebaseWiki article ...' - being the text shown
To create another alert-box - there is no need for you to even look at the alert_box_80 template - just use it as the page_under_construction template uses it.
Icons from Wikimedia Commons
[edit]You can find many images for use in alertboxes in the Wikimedia Commons - for example :