Hi, I am trying to rewrite a Wikipedia template without using html codes. If capital is the same as the largest town, then only one entry is shown, otherwise it will show two entries, i.e the capital and the largest town. I wrote like this but it is not working. Both conditions appear in the template:
{{#if: {{{capital}}} == {{{largest_city}}}| ! valign=top style="font-weight:normal;" {{!}} '''[[Capital (political)|Capital]]'''<br>(and largest city) ! valign=top style="padding:2px 10px; font-weight:normal;" {{!}} {{{capital}}} }} }} |- {{#if: {{{capital}}} !== {{{largest_city}}}| {{!}}- ! valign=top {{!}} [[Capital (political)|Capital]] ! valign=top style="padding:2px 10px; font-weight:normal;" {{!}} {{{capital}}} {{!}}- ! valign=top {{!}} Largest_city ! valign=top style="padding:2px 10px; font-weight:normal;" {{!}} {{{largest_city}}} }} }}
Your kind comments appreciated. I wanted to try "else" but I don't know the syntax, so I use the long method, LOL.
PM Poon
Ehrm. #if checks whether a string is empty or not, your ==s will not work here.
The syntax is: {{#if:whatsoever|non-empty|empty (optional)}} But what you need is: {{#ifeq:string1|string2|equal|non-equal (optional)}}
By the way, you may want to create a sub-template for one line of an infobox and reuse it.
— Kalan
mediawiki-l@lists.wikimedia.org