Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Template:Documentation header

The template returns a state of error, and optionally an error-message text in red (visible for the user).

Usage

The parameter Template:P can be set to the error to display when using this template.

  • Template:TlTemplate:Error
  • Compare, used in a Parser Function: {{#expr:Foo}}Expression error: Unrecognized word "foo".

If Template:P is unset, no error will be displayed, although it still can be detected by {{#iferror:}}

#iferror

The error displayed is detected by the parser function {{#iferror:}}.

  • {{#iferror: {{error|Foo}} | {{c|yes}} | {{c|no}} }}Template:C
  • {{#iferror: {{error}} | {{c|yes}} | {{c|no}} }}Template:C

Tag option

The tag to contain the error message can be given through the Template:P parameter, but it will only accept span, div, p, and strong, since those are the only tags recognized by the {{#iferror:}} parser function. It defaults to strong, the tag generated by most parsers, e.g. by {{#expr:}}.

Code Result
ABC Template:Tl XYZ ABC Template:Error XYZ
ABC Template:Tl XYZ ABC Template:Error XYZ
ABC Template:Tl XYZ ABC Template:Error XYZ
ABC Template:Tl XYZ ABC Template:Error XYZ
ABC Template:Tl XYZ ABC Template:Error XYZ

See also


cs:Šablona:Error/doc fr:Modèle:Erreur/doc it:Template:Errore/doc ja:テンプレート:Error/doc ko:틀:Error/doc lzh:模板:Error/doc pt:Predefinição:Erro/doc ru:Шаблон:Error/док th:แม่แบบ:Error/doc uk:Шаблон:Error/док zh:Template:Error/doc