"ഫലകം:If empty/doc" എന്ന താളിന്റെ പതിപ്പുകൾ തമ്മിലുള്ള വ്യത്യാസം
Content deleted Content added
Intermediate save. |
More documentation. |
||
വരി 6:
This is a meta-template that is used inside other templates. It takes several parameters and returns the first one of them that is defined (not null) and not empty.
The MediaWiki parameter default function doesn't return the default value for empty parameters. That is, <code><nowiki>{{{logo|default.svg}}}</nowiki></code> does not return "default.svg" if the template was called like this: <code><nowiki>{{template|logo=}}</nowiki></code>.
The usual workaround is to do like this:
:<code><nowiki>{{#if:{{{logo|}}}| {{{logo}}} | default.svg }}</nowiki></code>
But this becomes complex when you want to check several parameters:
[[image:{{ifempty | {{{logo|}}} | {{{image|}}} | default.png }} | 100px ]]▼
:<code><nowiki>{{#if:{{{logo|}}}| {{{logo}}} | {{#if:{{{image|}}} | {{{image}}} | default.svg }}}}</nowiki></code>
Then it is easier to use this template instead:
▲
=== Examples ===
|