Template talk:Ifim

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Parameter problems problem solved[edit]

The code part of template {{Simple bullets}} consists of the coding

[[Image:Bullet-blue.png|50px]] [[Image:Bullet-green.png|50px]] [[Image:Bullet-ambar.png|50px]]  [[Image:Bullet-red.png|50px]] [[Image:Bullet-grey.png|50px]]

which displays
(all five images, even when transcluded in one of the file descriptions: the image itself is displayed as an other version).


To avoid this, {{Ifim}} can be used:

{{Ifim|Bullet-blue.png|Bullet-green.png|Bullet-ambar.png|Bullet-red.png|Bullet-grey.png|p1=50px}}

displays suppressing the display of the file from which description is transcluded. This works well.


But when written

{{Ifim
|Bullet-blue.png
|Bullet-green.png
|Bullet-ambar.png
|Bullet-red.png
|Bullet-grey.png
|p1=50px}}

the line-end (CR LF) distroys the display, the output will be:

An equivalent error occurs when the pipe is coded right:

{{Ifim|
Bullet-blue.png|
Bullet-green.png|
Bullet-ambar.png|
Bullet-red.png|
Bullet-grey.png|
p1=50px}}


To overcome this fault, it can be written like

{{Ifim
|1=Bullet-blue.png
|2=Bullet-green.png
|3=Bullet-ambar.png
|4=Bullet-red.png
|5=Bullet-grey.png
|p1=50px}}

and the display will work:


Problem solution[edit]

With named parameters, you can use {{{parametername|}}} to trim it. With unnamed parameters this does not work, but there is the workaround {{#if:trim|{{{1}}}}}. Alternatively, you can give the parameter for Ifim1 a name and trim it there. --mfb (talk) 13:14, 9 December 2014 (UTC)[reply]