Template:If

From UOGuide

Jump to: navigation, search

A conditional template, which can take either numbered or named parameters:

{{if|<test>|<then>|<else>}}

If the test parameter is an empty string, the value of else is displayed. Otherwise, the value of then is displayed.

How it works: The template {{show1}} displays either the first parameter or the parameter named 1. The "if" template works by assigning the then value to 1, then assigning the else value to a parameter whose name is 1 followed by the contents of the test parameter. If test is an empty string, then the result is to assign else's to 1, overriding the prior value.

Personal tools