Help:Templates: Difference between revisions
New page: ==Control template inclusion== You can control template inclusion by the use of <code><nowiki><noinclude></nowiki></code> and <code><nowiki><includeonly></nowiki></code> tags. Anything b... |
No edit summary |
||
| (3 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
==About== | |||
We use templates to control the layout of our pages. | |||
==Creating a template== | |||
Template names are prefixed with <code>Template:</code>, you create them like any other wiki page. | |||
==Using a template== | |||
Templates are wiki pages which can be used in other pages in three ways: | |||
*<code><nowiki>{{Name}}</nowiki></code> includes the content of the template at the moment the page containing it is fetched <nowiki>"[[Template:Name]]"</nowiki>. | |||
*<code><nowiki>{{subst:Name}}</nowiki></code> inserts the content of the template into the code of the page in a form that is editable normally <nowiki>"[[Template:Name]]"</nowiki> after you have saved your text. | |||
*<code><nowiki>{{msgnw:Name}}</nowiki></code> when the page containing it is fetched, includes the template in a form that displays it as raw wiki syntax, like <code><nowiki><nowiki></nowiki></code> does | |||
==Control template inclusion== | ==Control template inclusion== | ||
You can control template inclusion by the use of <code><nowiki><noinclude></nowiki></code> and | You can control template inclusion by the use of <code><nowiki><noinclude></nowiki></code> and | ||
| Line 20: | Line 30: | ||
won't be updated until those pages are edited. | won't be updated until those pages are edited. | ||
== Transcluding a page that isn't a template == | |||
You can also transclude a non-template page by putting using <nowiki>{{Namespace:Page title}}</nowiki>. The main namespace is the default, so using :Page title will include a regular article. This kind of transclusion is used to make the "On one page" tabs on our gene pages. | |||
== List of Table Templates in EcoliWiki == | |||
See [[:Category:Table_templates]] | |||
[[Category:Help]] | [[Category:Table templates]] | ||
[[Category:Editing Help]] | [[Category:Help|Templates]] | ||
[[Category:Editing Help|Templates]] | |||
Latest revision as of 20:46, 6 June 2012
About
We use templates to control the layout of our pages.
Creating a template
Template names are prefixed with Template:, you create them like any other wiki page.
Using a template
Templates are wiki pages which can be used in other pages in three ways:
{{Name}}includes the content of the template at the moment the page containing it is fetched "[[Template:Name]]".{{subst:Name}}inserts the content of the template into the code of the page in a form that is editable normally "[[Template:Name]]" after you have saved your text.{{msgnw:Name}}when the page containing it is fetched, includes the template in a form that displays it as raw wiki syntax, like<nowiki>does
Control template inclusion
You can control template inclusion by the use of <noinclude> and
<includeonly> tags.
Anything between <noinclude> and </noinclude> will be processed and
displayed only when the page is being viewed directly, not included.
Possible applications are:
- Categorising templates
- Interlanguage links to similar templates in other languages
- Explanatory text about how to use the template
The converse is <includeonly>. Text between <includeonly> and
</includeonly> will be processed and displayed only when the page is
being included. The obvious application is to add all pages containing a given template to a category.
Note that the usual update problems apply -- if you change the categories inside a template, the categories of the referring pages won't be updated until those pages are edited.
Transcluding a page that isn't a template
You can also transclude a non-template page by putting using {{Namespace:Page title}}. The main namespace is the default, so using :Page title will include a regular article. This kind of transclusion is used to make the "On one page" tabs on our gene pages.