Help:Template programming

From TDWG Terms Wiki
Jump to: navigation, search


A detailed overview for template programming is given on MediaWiki’s help page (mediawiki.org). One important thing to remember is the equal sign (=) because it always denotes and separates a template parameter. Example:

{{Display fabulous URL|https://www.mediawiki.org/wiki/Help:Templates}}

… will recognise the unnamed first parameter automatically (i.e. the first position after the template name {{Display fabulous URL|…}} will be used inside the template as parameter {{{1}}}); BUT the following does not work so:

{{Display fabulous URL|https://www.mediawiki.org/w/index.php?title=Help:Templates/de&action=history}}

The Wiki parser will search for the equal sign and here the template parameter will be mistaken: it will be the yellow marked part in this template call! In such a case you have to program it explicitly to use parameter 1, like so, to get it working:

{{Display fabulous URL|1=https://www.mediawiki.org/w/index.php?title=Help:Templates/de&action=history}}


You can start programming a template with the following form (it contains a prefilled basic content and sections; see template: TemplateError/preload/en):