Help:Templates
From QED
| Help |
|
| Related topics |
For help on MediaWiki templates in general, including how to create new templates, see Template.
For a guide to existing QED templates, see Templates.
For information about navigational templates, see Help:Navigational Templates.
Contents |
Transcluding one page within another
In general, it is possible to transclude the contents of a page (the source page) within another page (the master page). If the source page is in the main namespace, simply use the following syntax:
- {{:Page title}}
where Page title is the title of the source page.
For example:
= Big Headings =
{{:Quantum Electrodynamics}}
{{:Quantum Foam}}
The content of each target page will be displayed at the point of transclusion when the master page is rendered. Any change to the content of one of the target pages will automatically be seen when the master page is next rendered. To force re-rendering, see Help:Refresh.
Using "=", "|", "{{" and "}}" within a template parameter value
When a literal "=" cannot be used, one option is to use Template:eq, e.g.
{{dotted box
|The equation is E {{eq}} mc<sup>2</sup>
}}
produces:
| The equation is E = mc2 |
Similarly:
- {{((}} and {{))}} can be used when literal {{ or }} strings are required.
- {{!}} can be used when | is required.
- {{!-}} can be used when |- is required.
There may be other options. For example, for URLs, it is probably a good idea to "urlencode" them anyway.
Another way to handle "=" within template parameters is to use the numbered-parameter syntax, e.g. the following are equivalent and produce x=y:
- {{target|1=http://abc.def.org?x=y|2=x=y}}
- {{target|http://abc.def.org?x{{eq}}y|x{{eq}}y}}
Named values
One way to define a set of named values (i.e. defined constants) would be to define a corresponding set of templates but it is usually better to define a single template that maps names to values.
For example, the standard color for "Cambrian" is Cambrian, and one could define a set of templates accordingly, but it is usually better to define a single template as a mapping.
This is illustrated by Template:period color, which is defined so that for example {{period color|Cambrian}} produces rgb(147,171,110). For an illustration of how this is used in practice, see Help:Timeline.
For details about how to implement such a mapping, see Template:period color.












