Template:Infobox/doc: Difference between revisions

From Japanese Mahjong Wiki
Jump to navigation Jump to search
(A working infobox and some tutorial code)
 
No edit summary
Line 11: Line 11:
}}</pre>
}}</pre>


header1 will be shown if any of item_one, item_two, or item_three is defined. If none of the three parameters are defined the header won't be shown.
Here is an example infobox


The trick to this is that the "if" returns false only if there is nothing whatsoever in the conditional section, so only if all three of item_one, item_two and item_three are undefined will the if statement fail.
{{Infobox
|bodystyle  = width:20em;
|name        =
|title      = Test Infobox
|titlestyle  =
|headerstyle =
|labelstyle  = width:33%
|datastyle  =
 
|header1 =
|label1  = Label 1
|data1  = Data 1
|header2 =
|label2  = Label 2
|data2  = Data 2
|header3 =
|label3  = Label 3
|data3  = Data 3
|header4 = Header 4
|label4  =
|data4  =
|header5 =
|label5  = Label 5
|data5  = Data 5: Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
 
|belowstyle =
|below = Below text
}}


<pre style="overflow: auto">
{{Infobox
{{Infobox
|bodystyle  = width:20em;
|bodystyle  = width:20em;
Line 43: Line 71:
|below = Below text
|below = Below text
}}
}}
</pre>
{{clear}}

Revision as of 01:56, 4 August 2013

{{Infobox
|name    = {{subst:PAGENAME}}
|title   = Example of an optional header
|header1 = {{#if:{{{item_one|}}}{{{item_two|}}}{{{item_three|}}}|Optional header}}
|label2  = Item one
|data2   = {{{item_one|}}}
|label3  = Item two
|data3   = {{{item_two|}}}
|label4  = Item three
|data4   = {{{item_three|}}}
}}

Here is an example infobox

Test Infobox
Label 1 Data 1
Label 2 Data 2
Label 3 Data 3
Header 4
Label 5 Data 5: Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

Below text

{{Infobox
|bodystyle   = width:20em;
|name        = 
|title       = Test Infobox
|titlestyle  = 
|headerstyle = 
|labelstyle  = width:33%
|datastyle   = 

|header1 = 
|label1  = Label 1
|data1   = Data 1
|header2 = 
|label2  = Label 2
|data2   = Data 2
|header3 = 
|label3  = Label 3
|data3   = Data 3
|header4 = Header 4
|label4  = 
|data4   = 
|header5 = 
|label5  = Label 5
|data5   = Data 5: Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

|belowstyle = 
|below = Below text
}}