Topic on Project:Support desk

Template which expands to 4 columns (Conditional Table)

4
Summary by AhmadF.Cheema

Newlines can cause weird behaviours.

Blumenfuchs (talkcontribs)

Hey,

I`ve got problems building a template, which should be a table that expands up to 4 columns.

That´s the template-code:

<onlyinclude>{| class="wikitable"

|- {{#if: {{{Skills 1-4|}}} |

{{!}} Skills: {{!!}}

{{{Skills 1-4}}} {{!!}} {{{Skills 5-8}}} {{!!}} {{{Skills 9-12}}}

}}

|- |}

Including it into a page, it would look like that:

{{NameofmyTemplate

|Skills 1-4= |Skills 5-8= |Skills 9-12=

}}

But the {{!!}} after {{{Skills 1-4}}} and {{{Skills 5-8}}} don´t work, I just get displayed pipes, but actually I wanted that the Skills 5-8 and will be shown in additional columns. I only get displayed the column "Skills" and a second column where the contents of Skills 1-4, Skills 5-8 and Skills 9-12 are displayed. The skills should be listed with bullet points, so I typed them in like

*1. Skill

*2. Skill

Could anybody tell me how I get more columns, but only if there´s content in Skills 5-8 or 9-12?

AhmadF.Cheema (talkcontribs)

Apparently, the newline after the line {{!}} Skills: {{!!}} in your code is causing problems. Try the following:

{| class="wikitable"
|-
{{#if: {{{Skills 1-4|}}} |
{{!}} Skills: {{!!}} {{{Skills 1-4|}}} {{#if: {{{Skills 5-8|}}} | {{!!}} {{{Skills 5-8|}}} |}} {{#if: {{{Skills 9-12|}}} | {{!!}} {{{Skills 9-12|}}} |}}
|}}
|}

Don't know yet how to get the bullet points included in the table, though.

Update: For bullet points you can use the following::

{| class="wikitable"
|-
{{#if: {{{Skills 1-4|}}} |
{{!}} Skills: {{!!}} <li>{{{Skills 1-4|}}}</li> {{#if: {{{Skills 5-8|}}} | {{!!}} <li>{{{Skills 5-8|}}}</li> |}} {{#if: {{{Skills 9-12|}}} | {{!!}} <li>{{{Skills 9-12|}}}</li> |}}
|}}
|}

A practically exact copy of the above, but with better template page representation:

{| class="wikitable"
|-
{{#if: {{{Skills 1-4|<noinclude>a</noinclude>}}} |
{{!}} Skills: {{!!}} <li>{{{Skills 1-4|<noinclude>Skill alpha</noinclude>}}}</li> {{#if: {{{Skills 5-8|<noinclude>b</noinclude>}}} | {{!!}} <li>{{{Skills 5-8|<noinclude>Skill beta</noinclude>}}}</li> |}} {{#if: {{{Skills 9-12|<noinclude>c</noinclude>}}} | {{!!}} <li>{{{Skills 9-12|<noinclude>Skill gamma</noinclude>}}}</li> |}}
|}}
|}
This post was hidden by Neil Shah-Quinn (history)
Blumenfuchs (talkcontribs)

Thank you so much :)