Difference between revisions of "Template:Infobox/Doc"

Jump to navigation Jump to search
466 bytes removed ,  07:13, 29 January 2022
no edit summary
Line 11: Line 11:
     ...
     ...
   <tr>
   <tr>
       <td class="ibfobox-data-title">...</td>
       <td class="infobox-data-title">...</td>
       <td class="ibfobox-data">...</td>
       <td class="infobox-data">...</td>
   </tr>
   </tr>
     ...
     ...
Line 24: Line 24:
|-
|-
...
...
|class="ibfobox-data-title"| ...
|class="infobox-data-title"| ...
|...
|...
|-
|-
Line 43: Line 43:


<code>file</code> - for an image file
<code>file</code> - for an image file
* In the code: <code><nowiki>{{#if: {{{file|}}}|<tr><td colspan="2">[[File:{{{file|}}}{{!}}250px{{!}}center]]</td></tr>}}</nowiki></code>
* In the code: <code><nowiki>{{#if: {{{file|}}}|<tr><td colspan="2">[[File:{{{file|}}}{{!}}250px{{!}}center]]</td></tr>}}</nowiki></code>
** <code>#if:</code> once again means it's optional, but in this case there is no default value, in other words, if no image is provided there will nothing; otherwise function adds new row in the table, which will contain image
** <code>#if:</code> once again means it's optional, but in this case there is no default value, in other words, if no image is provided there will nothing; otherwise function adds new row in the table, which will contain image
** [[mw:Help:Images|wiki mark up for images]] sets how image will be formatted inside the infobox, in this case it has fixed width - <code>250px</code>, and align - <code>center</code>, but these values can be set up as another pair of parameters
** [[mw:Help:Images|wiki mark up for images]] sets how image will be formatted inside the infobox, in this case it has fixed width - <code>250px</code>, and align - <code>center</code>, but these values can be set up as another pair of parameters
Line 59: Line 59:
<code>prm1</code> - second data parameter, with "Parameter 2" title
<code>prm1</code> - second data parameter, with "Parameter 2" title
* In the code:<br><code><nowiki>{{#if: {{{prm2|}}}|<tr>
* In the code:<br><code><nowiki>{{#if: {{{prm2|}}}|<tr>
           <td class="ibfobox-data-title">Parameter 2</td>
           <td class="infobox-data-title">Parameter 2</td>
           <td class="ibfobox-data">{{{prm2}}}</td>
           <td class="infobox-data">{{{prm2}}}</td>
     </tr>}}</nowiki></code>
     </tr>}}</nowiki></code>
** <code>#if:</code> again means it's optional, but if filled it will add a row with two columns
** <code>#if:</code> again means it's optional, but if filled it will add a row with two columns
Line 69: Line 69:
* and several '''classes'''
* and several '''classes'''
** <code>infobox</code> for entire table - this wiki already has such class in [[MediaWiki:Common.css|Common.css]] page; most notably it puts the box into right side of the page and gives it background color and border
** <code>infobox</code> for entire table - this wiki already has such class in [[MediaWiki:Common.css|Common.css]] page; most notably it puts the box into right side of the page and gives it background color and border
** <code>ibfobox-data-title</code> - for column with data titles; will be a custom class in [[Template:Classic infobox/styles.css]] page - for educational purposes it will brighter than usual Wikipedia style
** <code>infobox-data-title</code> - for column with data titles; will be a custom class in [[Template:Classic infobox/styles.css]] page - for educational purposes it will brighter than usual Wikipedia style
** <code>ibfobox-data</code> - for second column, with data values; same as previous
** <code>infobox-data</code> - for second column, with data values; same as previous


===Categories===
===Categories===
Line 82: Line 82:
To use infobox on another page, this code must be used:
To use infobox on another page, this code must be used:
<pre>
<pre>
{{Classic infobox
{{infobox
|title =
|title =
|file =  
|file =  
Line 88: Line 88:
|prm1 =  
|prm1 =  
|prm2 =  
|prm2 =  
}}</pre>{{Classic infobox
}}</pre>
Per break down above, the only obligatory parameter here <code><nowiki>{{{prm1}}}</nowiki></code>.
 
 
If everything is left empty, the output will be:
 
{{infobox
|title =
|title =
|file =  
|file =  
Line 94: Line 100:
|prm1 =  
|prm1 =  
|prm2 = }}
|prm2 = }}
Per break down above, the only obligatory parameter here <code><nowiki>{{{prm1}}}</nowiki></code>.
If everything is left empty, the output will be:


Code of filled up example:
<pre>
{{Classic infobox
|title = This is the title
|file = De Alice's Abenteuer im Wunderland Carroll pic 15.jpg
|caption = How far into the template rabbit hole do you go?
|prm1 = Flowers
|prm2 = Mushrooms}}</pre>
{{Classic infobox
|title = This is the title
|file = De Alice's Abenteuer im Wunderland Carroll pic 15.jpg
|caption = How far into the template rabbit hole do you go?
|prm1 = Flowers
|prm2 = Mushrooms}}
Gives:


<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox | |
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox | |
[[Category:Infobox templates| ]]}}</includeonly>
[[Category:Infobox templates| ]]}}</includeonly>

Navigation menu