Template talk:Qif: Difference between revisions

From Hattrick
Jump to navigationJump to search
Duno7 (talk | contribs)
No edit summary
 
Duno7 (talk | contribs)
mNo edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
== Purpose and Function ==
== Purpose and Function ==
* '''This template does not work at this point'''. For some reason, which I suspect is the fact that in this wiki the pipe symbol works a bit different from the way it work sin Wikipedia, or that something is missing, it is currently not possible to get this Template working like it should. Could some template expert take a look at this? Other related templates are [[Template:Show1]] and [[Template:Boolnot]]. Additional info about  [http://en.wikipedia.org/wiki/Category:Boolean_Templates]. --[[User:Duno7|duno7]] 16:10, 28 November 2005 (UTC)
* This is an implementation of the "if ... then ... else" behaviour, to be used mostly in other Templates.  
* This is an implementation of the "if ... then ... else" behaviour, to be used mostly in other Templates.  
* This function has ''undefined behaviour'' if parameter '''test''' or '''then''' is missing, or there are additional parameters defined. Parameter '''else''' is optional.
* This function has ''undefined behaviour'' if parameter '''test''' or '''then''' is missing, or there are additional parameters defined. Parameter '''else''' is optional.
Line 20: Line 22:
|
|
<pre>{{qif
<pre>{{qif
   |test={{boolne|foo|bar}}
   |test={{boolnot|true}}
   |then=true
   |then=true
   |else=false
   |else=false
Line 26: Line 28:
|
|
{{qif
{{qif
   |test={{boolne|foo|bar}}
   |test={{boolnot|true}}
   |then=true
   |then=true
   |else=false
   |else=false

Latest revision as of 16:10, 28 November 2005

Purpose and Function

  • This template does not work at this point. For some reason, which I suspect is the fact that in this wiki the pipe symbol works a bit different from the way it work sin Wikipedia, or that something is missing, it is currently not possible to get this Template working like it should. Could some template expert take a look at this? Other related templates are Template:Show1 and Template:Boolnot. Additional info about [1]. --duno7 16:10, 28 November 2005 (UTC)
  • This is an implementation of the "if ... then ... else" behaviour, to be used mostly in other Templates.
  • This function has undefined behaviour if parameter test or then is missing, or there are additional parameters defined. Parameter else is optional.
  • This is basically the same as the Wikipedia template [2], please check the discussion page on the wikipedia for more information.

Usage

{{qif
  |test=VARIABLE_OR_PARAMETER_TO_TEST
  |then=code if true or empty
  |else=code if true or empty
}}

Example

Code Result
{{qif
  |test={{boolnot|true}}
  |then=true
  |else=false
}}

false

{{qif
  |test={{booleq|foo|bar}}
  |then=true
  |else=false
}}

true

{{qif
  |test=
  |then=bar
}}
{{qif
  |test=foo
  |then=bar
}}

Comments

Ok, let's see if this works. It can be useful in some templates (for hiding empty fields, or similar) --duno7 15:24, 28 November 2005 (UTC)