"ഫലകം:If empty/doc" എന്ന താളിന്റെ പതിപ്പുകൾ തമ്മിലുള്ള വ്യത്യാസം

Created as needed.
Undid revision 740872154 by 24.107.145.1 (talk) Sorry! My bad!
വരി 2:
{{Template redirects |Ifempty |First nonempty |Use first nonempty}}
{{Lua|Module:If empty}}
{{High-risk | 640000+ }}
 
<!----PLEASE ADD CATEGORIES WHERE INDICATED AT THE BOTTOM OF THIS PAGE---->
 
വരി 29:
====Piping====
Parameters used with {{tlf|if empty}} must be [[Pipe (Unix)|pipe]]d&nbsp;– i.e. include the [[Vertical bar|vertical bar (pipe) symbol]] {{nowrap|("{{thinsp}}&#124;{{thinsp}}")}} as a trailing character&nbsp;– so that empty or undefined parameters aren't treated as text and returned incorrectly. Hence, for example, <code><nowiki>{{{logo|}}}</nowiki></code>, <code><nowiki>{{{image|}}}</nowiki></code> and <code><nowiki>{{{picture|}}}</nowiki></code> rather than {{param|logo}}, {{param|image}} and {{param|picture}} in the above examples.
 
===Examples===
{{Aligned table |class=wikitable
|cols=3 |col1style=padding-right:1.0em; |col2style=padding-left:0.5em;padding-right:1.0em; |col3style=padding-left:0.5em;
|row1style=background:whitesmoke;padding-left:0.5em;font-weight:bold;
| Code | Result |
| {{tc|if empty}} | {{if empty}} | Returns an empty string.
| {{tc|if empty|one}} | {{if empty|one}} | Returns the first parameter that is defined and not empty.
| {{tc|if empty|one|two}} | {{if empty|one|two}} |
| {{tc|if empty|one|two|three|four}} | {{if empty|one|two|three|four}} |
| {{tc|if empty||two}} | {{if empty||two}} | The first parameter is empty/undefined, so is passed over.
| {{tc|if empty||two|three|four}} | {{if empty||two|three|four}} |
| {{tc|if empty||two||four}} | {{if empty||two||four}} |
| <code><nowiki>{{if empty||||||||||ten}}</nowiki></code> | {{if empty||||||||||ten}} | Unlike in previous versions, this template is no longer limited by 9 parameters.
| {{tc|if empty|}} | {{if empty|}} | The only parameter is empty or undefined, so returns an empty string.
| {{tc|if empty||||}} | {{if empty||||}} | Returns an empty string.
| <code><nowiki>{{if empty|{{{1|}}}|{{{2|}}}|three}}</nowiki></code> | {{if empty|{{{1|}}}|{{{2|}}}|three}} |
| <code><nowiki>{{if empty|{{{1}}}|{{{2}}}|three}}</nowiki></code> | {{if empty|{{{1}}}|{{{2}}}|three}} | No pipe-characters following the names of the first two parameters ("1" and "2"), so the first of these returned as text ("{{{1}}}").
| <code><nowiki>{{if empty|{{{logo|}}}|two}}</nowiki></code> | {{if empty|{{{logo|}}}|two}} |
| <code><nowiki>{{if empty|{{{logo}}}|two}}</nowiki></code> | {{if empty|{{{logo}}}|two}} | No pipe-character following the parameter name "logo", so the text "{{{logo}}}" returned.
| <code><nowiki>{{if empty|p=q}}</nowiki></code> | {{if empty|p=q}} | The template identifies the parameters it receives as parameters 1 to 9, not using names such as "p", etc.
}}
 
===See also===
"https://ml.wikipedia.org/wiki/ഫലകം:If_empty/doc" എന്ന താളിൽനിന്ന് ശേഖരിച്ചത്