Template
-
- Last edited 5 years ago by MLR
-
-
- This page is a draft but has an approved version
Contents
What are templates?
Templates are (source)-text templates that can be integrated into other pages of the wiki. On the one hand, this has the advantage of outsourcing frequently used components such as letter templates or checklists so that they do not have to be recreated every time. On the other hand, a certain uniformity can be ensured by means of templates. In addition, using templates provides some flexibility, as changes can be centralized and affect all pages that access the template. Accordingly, possible applications for templates are the management of messages, the presentation of consistent navigation areas, or simply the unification of a group of pages.
Create new templates
A new template is created just like an article page, just in the namespace Template.
For example, the full page name of a template MyPatient is Template:MyPatient.
Use existing templates
A template is used in a page by putting the name of the template (ie the title of the template page, without the name space "Template:") in two curly brackets:
- {{My original}}
Such a usage causes the parenthesized text to be replaced with the source text of the template when calling the using page. The source text of the using page will continue to contain the compounded text so future changes to the template will affect existing uses of the template as well. The source code of the template can also be generated optionally when the page is saved instead of when the page is called up. The following form is used for this:
- {{subst:My original}}
This may be useful if you want to create an initial text that you want to change later on each new page.
For templates, the namespace "Template:" is reserved. All pages in this namespace are considered templates, but not all of these templates may be relevant to any article author. The complete list of all pages in this namespace can be found using the Special page of the namespace Template.
Edit existing templates
Before existing templates are changed significantly, the project should be briefly discussed or announced on the discussion page of the respective template.
Built-in variables
Each MediaWiki has a number of built-in variables that are not pages in the "template:" namespace, but are still used as templates.
For example, the variable {{CURRENTTIME}} (the current UTC time) currently returns the value 11:20.
Further notes
- The use of templates is basically translusions. It is also possible to use pages that are not in the corresponding namespace as templates. However, this is to be done wisely, since some functions require that the pages are in the template namespace.
- Templates can also be used to define the output of semantic query. For more information, see here. (This is an example where the pages must necessarily be in the template namespace.)
Templates at BlueSpice
Internal links
- All namespace pages Template - All template pages except built-in variables