साचा:If then show/doc

विकिपीडिया, मुक्‍त ज्ञानकोशातून

This template tests whether the first unnamed parameter is not an empty string and returns it if it does. Otherwise it returns the second unnamed parameter.

This is useful when the first parameter is a {{#invoke: }} of a Lua module that may return a value or nothing. Because it uses the {{#invoke: }} just once, it simplifies the coding of infoboxes, for example.

The optional third and fourth unnamed parameters provide a prefix and a suffix for the first parameter when returned. This enables the designer to construct more complex templates that still only use once invoke of a Lua module.

Usage[संपादन]

वैवाहिक जोडीदार (P26) for Richard Burton (Q151973)
{{If then show|{{#invoke:WikidataIB|getValue|P26|qid=Q151973|fwd=ALL|osd=no}}|unmarried}}एलिझाबेथ टेलर, Sybil Christopher, Suzy Miller, एलिझाबेथ टेलर, Sally Burton Edit this on Wikidata
वैवाहिक जोडीदार (P26) for फ्रांत्स काफ्का (Q905)
{{If then show|{{#invoke:WikidataIB|getValue|P26|qid=Q905|fwd=ALL|osd=no}}|unmarried}} → unmarried

Prefix and suffix[संपादन]

A table can be designed to display a row only when a particular property of the article exists on Wikidata.

वैवाहिक जोडीदार (P26) for Richard Burton (Q151973)
{| class="wikitable"
|-
! style="width:15em;" | Label
! style="width:30em;" | Value
{{If then show|{{#invoke:WikidataIB|getValue|P26|qid=Q151973|fwd=ALL|osd=no}}||<tr><th>{{#invoke:WikidataIB|getLabel|P26|qid=Q151973}}</th><td>|</td></tr>}}
|}
Label Value
वैवाहिक जोडीदारएलिझाबेथ टेलर, Sybil Christopher, Suzy Miller, एलिझाबेथ टेलर, Sally Burton Edit this on Wikidata
वैवाहिक जोडीदार (P26) for फ्रांत्स काफ्का (Q905)
{| class="wikitable"
|-
! style="width:15em;" | Label
! style="width:30em;" | Value
{{If then show|{{#invoke:WikidataIB|getValue|P26|qid=Q905|fwd=ALL|osd=no}}||<tr><th>{{#invoke:WikidataIB|getLabel|P26|qid=Q905}}</th><td>|</td></tr>}}
|}
Label Value