Template:Icon

From TrainzOnline
Jump to: navigation, search
Purpose

This template encapsulates an icon sized image in a self-defined independent table defined as below.

  • It is used primarily as a table element in a table breaking out page links where an icon such as surveyor tools buttons is desired.
<table><tr><td max-width="{{{max|40px}}}">[[image:{{{img|{{{1|wikilogo.png}}}}}}
 |{{{size|40x40px}}}|{{{pos|left}}}|alt=|{{{cap|}}}]]<td><tr></table>
which decomposed looks...

<table><tr><td max-width="{{{max|40px}}}">

[[image:{{{img|{{{1|wikilogo.png}}}}}}

|{{{size|40x40px}}}

|{{{pos|left}}}

|alt=|{{{cap|}}}]]

<td><tr></table>

This means a call with all parameters defined would appear: {{{{#if:| }}icon{{#if:| | {{{2}}} }}{{#if:| | {{{3}}} }}{{#if:| | {{{4}}} }}{{#if:| | {{{5}}} }}{{#if:| | ... }}{{#if:| }}}}

... or since parserFunctions aren't currently enabled:

{{icon|max=a|img=b|size=c|pos=d|cap=d}}

so the parameters can be defined to override the defaults as follows:

# parameter
call
Parameter effects description, limits and bounds
1 |max= a where a is a width in pixels setting the maximum width of the bounding table
2 |img= b where b is a namespace-less image file name in the File Namespace.
3 |size=c where c is a width in pixels (px), which for icons is normally given as a cross-spec such as '64x64px' or '32x32px'.
4 |cap=d where d is a caption, which is an extension of the template for other than icon uses. Icons do not get captions.
n/a |alt= above may appear to be a parameter, but is an HTML void definition for the normal alt= define in web page rendering under HTML. In effect it is Nullified.

 

Caution
  • Since the template is used within wikitables by design, failure to properly close the parentheses may lead to spectacular looking crude.
Expanding the template onto several lines may be problematic.
  • If you do so, indent each pipe character at least one or two spaces like the below:
{{icon
  |max=50px
  |img=surveyor-up-tool.jpg
}}

 
 

Personal tools