Log in Discussion History Go to the site toolbox

Template:Ifeq

From BluWiki

Do NOT touch this template unless you can understand it completely.

Documentation: The first parameter is the "condition" (can be named "if"); if it's equal to the second parameter (called "eq"), the third parameter (can be named "then") is shown, otherwise the fourth parameter "else" is shown.

Caveats:

  1. If you name one parameter, you have to name all the ones you use (unused ones can be left out).
  2. If either the "if" or "eq" params are named "call", bad things happen, so I sincerely hope you don't use either of those names. There's probably a nice workaround to this.

NOTE: Named parameters are preferred, because they are not susceptible to problems arising from embedded "=" signs in the data.

Importing from Wikipedia is easy if it uses only the if and ifeq parser functions. You should name each positional parameter (otherwise some templates with embedded = signs may fail mysteriously), then change #if: and #ifeq: to if| and ifeq|. For this template (ifeq), the first parameter is called "if", the second "eq", the third "then" and the fourth "else".

For example, you need to change

{{#ifeq:{{{1|}}}|true|<span class="cool">|<span class="hidden">}}

into

{{ifeq|if={{{1|}}}|eq=true|then=<span class="cool">|else=<span class="hidden">}}.

Site Toolbox:

Personal tools
GNU Free Documentation License 1.2
This page was last modified on 8 May 2010, at 03:48.
Disclaimers - About BluWiki