Template talk:If

From The Urban Dead Wiki
Jump to navigationJump to search

Usage

{{if|{{{variable|}}}|true result|false result}}

The {{if}} template checks if variable is set in a given template. If it is, it displays the true result, if not, displays the false result.

Parser Functions

This template is obsolete on other wikis and has been changed into a Parser Function, #if, as such any cases of #if in an imported template or template set from another wiki should be replaced with a call of this template.

Advanced Template

Most users are advised to try not using this, or any other If template for that matter, whenever possible. This is an Advanced Template and as such it's usage should be limited to cases where it is necessary for the sake of clarity in code.

Discussion On the If Template

Minor Change

I removed the space separating 3 from the end tags, it was causing errors(adding the space on inclusion) whenever the template was used and 3 wasn't another template or variable.--Karekmaps?! 15:20, 15 October 2007 (BST)

Another minor change

I made the variables explicit in the ifdef calls (i.e. added in the "1=" and "2=" in {{ifdef|1={{{1|}}}|2={{{2}}}}}) due to the fact that certain variables could break the formatting of the templates when included, causing it to not process them correctly (e.g. it would skip parameters). Shouldn't affect existing uses of the template, but should make it possible to use it with more complicated variables now. Aichon 03:00, 31 December 2009 (UTC)