Template:Infobox/doc: Difference between revisions

From Screamer Wiki
Jump to: navigation, search
imported>Default
m (14 revisions)
imported>Default
m (Protected "Template:Infobox/doc" (‎[edit=sysop] (indefinite) ‎[move=sysop] (indefinite)))
Line 1: Line 1:
==Description==
==Description==
*This template produces a [[Help:Infobox|infobox]]-style template.
This template is a sample infobox, to aid in the creation of new infoboxes.
*You may want to copy and modify this to create a specific infobox (e.g. character infobox).
 
*This template requires [[Help:Parser functions|parser functions]] to be enabled (Wikia default: on).
Recommended usage: copy the template code to a new template page, and edit it there.
 
===Infobox and template background===
See [[Help:Templates]], [[Help:Infobox]] and [[Help:Tables]] for some background on how templates and infoboxes work.
 
===Building blocks===
The infobox is made of the following basic building blocks:
 
* Overall table class: <code>class="wikia-infobox"</code>
* Table heading cell class: <code>class="wikia-infobox-header"</code>
* Use row header marks ("<code>!</code>") for row title cells ''(and "<code>|</code>" for normal cells)''
* Section separator line: give the header below it a wrapping <code>div</code> with <code>class="wikia-infobox-section-header"</code>
* Image cell class: <code>class="wikia-infobox-image"</code>
* Image caption cell class: <code>class="wikia-infobox-caption"</code>
 
===Other notes===
* The Title, First, Second, and Third rows show ''"Unknown"'' if their values are not specified.
* The Image, Imagecaption, Fourth, Fifth, and Sixth rows won't show up if their values are not specified: they are each completely enclosed in an 'if' statement.


==Syntax==
==Syntax==
<pre>
<pre>
{{infobox
{{infobox
|Box title   =  
| title         =  
|image       = Image:Example.jpg
| image         = [e.g. "Example.jpg"]
|imagewidth   = [defaults to 250]
| imagewidth   = [e.g. "150"] [default: 210 pixels]
|caption      = Bob the Flower
  | imagecaption =  
|Row 1 title  =
  | first        =
|Row 1 info  =
  | second        =
|Row 2 title =
  | third        =
|Row 2 info  =
  | fourth        =
|Row 3 title =
  | fifth        =
|Row 3 info  =
  | sixth        =
|Row 4 title =
|Row 4 info  =
|Row 5 title =
|Row 5 info  =
|Row 6 title =
|Row 6 info  =
|Row 7 title =
|Row 7 info  =
|Row 8 title =
|Row 8 info  =
|Row 9 title =
|Row 9 info  =
|Row 10 title =
|Row 10 info  =
}}
}}
</pre>
</pre>


===Notes===
==Samples==
* Keeping the '''Box Title''' empty will result in displaying '''No title'''
<pre>
* If you don't want to display image, just keep '''Image file Name''' and '''Image Size''' empty.
{{infobox
* Keeping the '''Row 1 title''' empty will result in displaying '''No title'''.
| title         = A pretty flower
* Keeping the '''Row (any row) info''' empty will result in displaying '''No information'''.
| image         = Example.jpg
* Keeping the '''Row (any below row 1) title''' empty will result in that row and the rest of the rows below it will not be displayed.
| imagewidth   = 100
* Max row for information: 10 rows.
  | imagecaption = Floweris flowerum
 
  | first        = Pink and green
==Sample output==
  | second        = Outdoors
{{Infobox
  | fourth        = Annual
|Box title   = Info Title
|image       = Image:Example.jpg
|imagewidth   = 120
|caption      = A flower
|Row 1 title  = Title row 1
|Row 1 info  = Info row 1
|Row 2 title  = Title row 2
|Row 2 info  = Info row 2
|Row 3 title = Title row 3
|Row 3 info  = Info row 3
|Row 4 title = Title row 4
|Row 4 info  = Info row 4
|Row 5 title = Title row 5
|Row 5 info  = Info row 5
|Row 6 title = Title row 6
|Row 6 info  = Info row 6
|Row 7 title  = Title row 7
|Row 7 info  = Info row 7
|Row 8 title = Title row 8
|Row 8 info  = Info row 8
|Row 9 title  = Title row 9
|Row 9 info  = Info row 9
|Row 10 title = Title row 10
|Row 10 info  = Info row 10
}}
}}
Complete Infobox:<br />
</pre>
<code>
'''<nowiki>{{</nowiki>Infobox'''<br />
'''|'''Box title    = Info Title<br />
'''|'''image        = Image:Example.jpg<br />
'''|'''imagewidth  = 120<br />
'''|'''caption      = A flower<br />
'''|'''Row 1 title  = Title row 1<br />
'''|'''Row 1 info  = Info row 1<br />
'''|'''Row 2 title  = Title row 2<br />
'''|'''Row 2 info  = Info row 2<br />
'''|'''Row 3 title  = Title row 3<br />
'''|'''Row 3 info  = Info row 3<br />
'''|'''Row 4 title  = Title row 4<br />
'''|'''Row 4 info  = Info row 4<br />
'''|'''Row 5 title  = Title row 5<br />
'''|'''Row 5 info  = Info row 5<br />
'''|'''Row 6 title  = Title row 6<br />
'''|'''Row 6 info  = Info row 6<br />
'''|'''Row 7 title  = Title row 7<br />
'''|'''Row 7 info  = Info row 7<br />
'''|'''Row 8 title  = Title row 8<br />
'''|'''Row 8 info  = Info row 8<br />
'''|'''Row 9 title  = Title row 9<br />
'''|'''Row 9 info  = Info row 9<br />
'''|'''Row 10 title = Title row 10<br />
'''|'''Row 10 info  = Info row 10<br />
'''<nowiki>}}</nowiki>'''
</code>


<br style="clear:both; margin-bottom:3em;"/>
Results in...


{{Infobox
{{infobox
|Box title    = Info Title
  | title         = A pretty flower
|Row 1 title  = Title row 1
  | image        = Example.jpg
|Row 1 info  = Info row 1
  | imagewidth   = 100
|Row 2 title  = Title row 2
  | imagecaption = Floweris flowerum
|Row 2 info  = Info row 2
  | first        = Pink and green
|Row 3 title = Title row 3
  | second        = Outdoors
|Row 3 info  = Info row 3
  | fourth        = Annual
|Row 4 title = Title row 4
|Row 4 info  = Info row 4
|Row 5 title = Title row 5
|Row 5 info  = Info row 5
|Row 6 title  = Title row 6
|Row 6 info  = Info row 6
|Row 7 title  = Title row 7
|Row 7 info  = Info row 7
|Row 8 title  = Title row 8
|Row 8 info  = Info row 8
|Row 9 title  = Title row 9
|Row 9 info  = Info row 9
|Row 10 title = Title row 10
|Row 10 info = Info row 10
}}
Infobox '''Image''' omitted :<br />
<code>
'''<nowiki>{{</nowiki>Infobox'''<br />
'''|'''Box title   = Info Title<br />
'''|'''Row 1 title = Title row 1<br />
'''|'''Row 1 info  = Info row 1<br />
'''|'''Row 2 title = Title row 2<br />
'''|'''Row 2 info  = Info row 2<br />
'''|'''Row 3 title = Title row 3<br />
'''|'''Row 3 info  = Info row 3<br />
'''|'''Row 4 title  = Title row 4<br />
'''|'''Row 4 info  = Info row 4<br />
'''|'''Row 5 title  = Title row 5<br />
'''|'''Row 5 info  = Info row 5<br />
'''|'''Row 6 title  = Title row 6<br />
'''|'''Row 6 info  = Info row 6<br />
'''|'''Row 7 title  = Title row 7<br />
'''|'''Row 7 info  = Info row 7<br />
'''|'''Row 8 title  = Title row 8<br />
'''|'''Row 8 info  = Info row 8<br />
'''|'''Row 9 title  = Title row 9<br />
'''|'''Row 9 info  = Info row 9<br />
'''|'''Row 10 title = Title row 10<br />
'''|'''Row 10 info  = Info row 10<br />
'''<nowiki>}}</nowiki>'''
</code>
 
<br style="clear:both; margin-bottom:3em;"/>
 
{{Infobox
|Box title    = Info Title
|Row 1 title  = Title row 1
|Row 1 info  = Info row 1
|Row 2 title  = Title row 2
|Row 2 info  = Info row 2
|Row 3 title  = Title row 3
|Row 3 info  = Info row 3
}}
Infobox '''Image''' omitted and displaying only 3 rows of information:<br />
<code>
'''<nowiki>{{</nowiki>Infobox'''<br />
'''|'''Box title    = Info Title<br />
'''|'''Row 1 title = Title row 1<br />
'''|'''Row 1 info  = Info row 1<br />
'''|'''Row 2 title  = Title row 2<br />
'''|'''Row 2 info  = Info row 2<br />
'''|'''Row 3 title  = Title row 3<br />
'''|'''Row 3 info  = Info row 3<br />
'''<nowiki>}}</nowiki>'''
</code>
 
<br style="clear:both; margin-bottom:3em;"/>
 
{{Infobox
|Box title    = Info Title
|Row 1 title  = Title row 1
|Row 1 info  = Info row 1
|Row 2 title = Title row 2
|Row 2 info  = Info row 2
|Row 3 title  = Title row 3
|Row 3 info  = Info row 3
|Row 4 info  = Info row 4
|Row 5 title  = Title row 5
|Row 5 info  = Info row 5
|Row 6 title  = Title row 6
|Row 6 info  = Info row 6
}}
}}
Infobox '''Image''' and '''title row 4''' omited:<br />
Result: Row 4, 5, and 6 will not be displayed.<br />
<code>
'''<nowiki>{{</nowiki>Infobox'''<br />
'''|'''Box title    = Info Title<br />
'''|'''Row 1 title  = Title row 1<br />
'''|'''Row 1 info  = Info row 1<br />
'''|'''Row 2 title  = Title row 2<br />
'''|'''Row 2 info  = Info row 2<br />
'''|'''Row 3 title  = Title row 3<br />
'''|'''Row 3 info  = Info row 3<br />
'''|'''Row 4 info  = Info row 4<br />
'''|'''Row 5 title  = Title row 5<br />
'''|'''Row 5 info  = Info row 5<br />
'''|'''Row 6 title  = Title row 6<br />
'''|'''Row 6 info  = Info row 6<br />
'''<nowiki>}}</nowiki>'''
</code>


<includeonly>[[Category:General wiki templates|{{PAGENAME}}]][[Category:Infobox templates| ]]</includeonly><noinclude>[[Category:Template documentation|{{PAGENAME}}]]</noinclude>
<includeonly>[[Category:General wiki templates|{{PAGENAME}}]][[Category:Infobox templates| ]]</includeonly><noinclude>[[Category:Template documentation|{{PAGENAME}}]]</noinclude>

Revision as of 12:30, 13 June 2015

Description

This template is a sample infobox, to aid in the creation of new infoboxes.

Recommended usage: copy the template code to a new template page, and edit it there.

Infobox and template background

See Help:Templates, Help:Infobox and Help:Tables for some background on how templates and infoboxes work.

Building blocks

The infobox is made of the following basic building blocks:

  • Overall table class: class="wikia-infobox"
  • Table heading cell class: class="wikia-infobox-header"
  • Use row header marks ("!") for row title cells (and "|" for normal cells)
  • Section separator line: give the header below it a wrapping div with class="wikia-infobox-section-header"
  • Image cell class: class="wikia-infobox-image"
  • Image caption cell class: class="wikia-infobox-caption"

Other notes

  • The Title, First, Second, and Third rows show "Unknown" if their values are not specified.
  • The Image, Imagecaption, Fourth, Fifth, and Sixth rows won't show up if their values are not specified: they are each completely enclosed in an 'if' statement.

Syntax

{{infobox
 | title         = 
 | image         = [e.g. "Example.jpg"]
 | imagewidth    = [e.g. "150"] [default: 210 pixels]
 | imagecaption  = 
 | first         =
 | second        =
 | third         =
 | fourth        =
 | fifth         =
 | sixth         =
}}

Samples

{{infobox
 | title         = A pretty flower
 | image         = Example.jpg
 | imagewidth    = 100
 | imagecaption  = Floweris flowerum
 | first         = Pink and green
 | second        = Outdoors
 | fourth        = Annual
}}

Results in...