Help:Transclusion

From OLPC
(Redirected from Templates)
Jump to navigation Jump to search

Transclusion is the process of include the content of a page in another page, by reference rather than by copying and pasting it. Templates are usually transcluded into pages : the template text exists once, and is editable in a single place. It is added to pages where it appears when the page is loaded.

You can transclude any page on the wiki, like so:

  {{welcome}}  will transclude the template [[Template:Welcome]] where it is placed in the page
  {{:welcome}} will transclude the page [[Welcome]] where it is placed

For more, see m:Help:Transclusion on the Meta-Wiki.

Templates

Templates are wiki pages in the Template: namespace. They are designed specifically to be transcluded. A template can be transcluded in a shorthand way, rather than saying

 {{:Template:welcome}} 

you can simply say

 {{welcome}} 

.

Common examples of templates are navigation bars for a set of pages and display templates with template variables that ensure a set of hundreds of entries are all displayed in the same style.