Template:Px/doc

This is the px meta-template.

It helps other templates, such as infoboxes, to take image size parameters in both of the forms "40" or "40px". It takes up to three parameters and returns the first one that has any content. That is, the first one that is defined (not null) and not empty. Thus a default value for the width of the image can be fed as the second or third parameter.

Usage
Here is what this template does. Code to the left, actual rendering to the right:



And with an optional second or even third parameter to be used as a default value if the first or second parameter is empty or undefined:





And here is how it can be used inside another template:



Note! The parameters to must use the pipe "|", like this:. Or else will be fed and return the string " " if width was not defined.