dimanche 30 août 2015

How do i encase Infobox Parameters inside a #if

I am trying to create a template based off the Infobox Template i exported from Wikipedia following the instructions here

I first got the Infobox working with the following code

{{Infobox
|above = Nanoha Takamachi
|image= [[Fie:nanoha.jpg|200px]]
|caption = Young Nanoha (left) and Adult Nanoha (right)
|data1 = http://ift.tt/1Fb3pP1

|header2 = Character Profile
|label3 = Other Names
|data3 = Ace of Aces<br/>The White Devil
}}

and that worked perfectly. given that this infobox will more or less be reused for other characters i figured i'd create it as a template so if i changed header2 it will apply to all uses of the template and for fields like label3 i can just provide the value of data3 (ie othername = Ace of Aces<br/>The White Devil)

Looking into the #if functionality i tried to turn data1 into an optional field to only appear if the parameter wikia is defined

{{Infobox
|above = {{{name}}}
|image= [[Fie:{{{image}}}|200px]]
|caption = {{{description}}}
|-
{{#if: {{{wikia|}}}|
{{!}}data1 = {{{wikia}}} }}

|header2 = Character Profile
|label3 = Other Names
|data3 = Ace of Aces<br/>The White Devil
}}

with {{!}} being just a | in a new template (Template:!) as i read that to use | inside #if i need to call another template

However while the the first 3 values appear the 4th doesn't appear, even when i replaced the ! Template with a |. when i change it to

|data1 = {{{wikia|}}}|{{{wikia}}} }}

it does appear when wikia is specified and disappears when it isn't. while it looks how i want it my goal was to also make label3 and data3 optional so they only appear if a single paramater is passed rather than doing something like this

|label3 = {{{othernames|}}}|Other Names }}
|data3 = {{{othernames|}}}|{{{othernames}}} }}

So how can I encase one or more infobox parameters inside the single #if

Aucun commentaire:

Enregistrer un commentaire