Template:Ifdef

From Sumo
Revision as of 09:09, 9 February 2011 by W-bamberger (talk | contribs) (Description: Link to opposite Template:Ifndef)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Description

{{Ifdef|{{{p}}}|then}}

Allows conditional code for optional parameters. If the parameter p is defined, the string then is inserted. The template is the opposite of Template:Ifndef. It is necessary, because the MediaWiki of Sourceforge here has not got the extended parser function like #if:. For further details, look at the Wikipedia pages Template:Ifdef and Help:Advanced templates#Branching techniques without ParserFunctions.

Example

{{ifdef|{{{url}}}|
{{!}}-
{{!}} colspan{{=}}"2" {{!}} {{{url}}} }}

If the parameter url is defined, the code results in

|-
| colspan="2" | http://a.url

If it is not defined, the code results in nothing.