Jump to content

User:40%-Dummy/Workspace

From Wikipedia, the free encyclopedia

Consecutive conditional table

[edit]

Preview

[edit]
Title row always shown    
First row always shown    



Code

[edit]
{| border="0" cellpadding="0" cellspacing="0" style="width:100%;"
|-
| 
{| celltabbing="0" cellspacing="0" style="margin-bottom:1em; width:100%; border:1px solid;"
! style="padding:0.5em 1em; border-bottom:1px solid; border-right:1px solid;" | {{{Title_Left|Title row always shown}}}
! style="padding:0.5em 1em; border-bottom:1px solid; border-right:1px solid;" | {{{Title_Mid| }}}
! style="padding:0.5em 1em; border-bottom:1px solid" | {{{Title_Right| }}}
|-
| style="padding:0.2em 1em; border-right:1px solid" | {{{Content_Left1|First row always shown}}}
| style="padding:0.2em 1em; border-right:1px solid" | {{{Content_Mid1| }}}
| style="padding:0.2em 1em;" | {{{Content_Right1| }}}
{{#if:{{{Content_Left2|}}}|{{!-}}
{{!}} style="padding:0.2em 1em; border-right:1px solid; border-top:1px solid;" {{!}} {{{Content_Left2|}}}
{{!}} style="padding:0.2em 1em; border-right:1px solid; border-top:1px solid;" {{!}} {{{Content_Mid2|}}}
{{!}} style="padding:0.2em 1em; border-top:1px solid;" {{!}} {{{Content_Right2|}}}}}
{{#if:{{{Content_Left3|}}}|{{!-}}
{{!}} style="padding:0.2em 1em; border-right:1px solid; border-top:1px solid;" {{!}} {{{Content_Left3|}}}
{{!}} style="padding:0.2em 1em; border-right:1px solid; border-top:1px solid;" {{!}} {{{Content_Mid3|}}}
{{!}} style="padding:0.2em 1em; border-top:1px solid;" {{!}} {{{Content_Right3|}}}}}
{{#if:{{{Content_Left4|}}}|{{!-}}
{{!}} style="padding:0.2em 1em; border-right:1px solid; border-top:1px solid;" {{!}} {{{Content_Left4|}}}
{{!}} style="padding:0.2em 1em; border-right:1px solid; border-top:1px solid;" {{!}} {{{Content_Mid4|}}}
{{!}} style="padding:0.2em 1em; border-top:1px solid;" {{!}} {{{Content_Right4|}}}}}
{{#if:{{{Content_Left5|}}}|{{!-}}
{{!}} style="padding:0.2em 1em; border-right:1px solid; border-top:1px solid;" {{!}} {{{Content_Left5|}}}
{{!}} style="padding:0.2em 1em; border-right:1px solid; border-top:1px solid;" {{!}} {{{Content_Mid5|}}}
{{!}} style="padding:0.2em 1em; border-top:1px solid;" {{!}} {{{Content_Right5|}}}}}
|}

Thoughts

[edit]
  • The "if" is included in the last cell of the previous row to avoid new table rows in case the next field is empty
  • Instead, this causes unnecessary line breaks if the table is not fully used
  • Any way to avoid this and still make it look good?

Other possibilities / Try and error

[edit]

Nested parser-functions - works - Problem: Expansion depth limit = 40? - Need more rows than that!

Title row always shown    
First row always shown