Help:Transclusion: Difference between revisions

From OLPC
Jump to navigation Jump to search
(New page: '''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 : ...)
 
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
'''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.
'''Transclusion''' is the process of include the content of a page in another page, by reference rather than by copying and pasting it. [[m:Help:Templates|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:
You can transclude any page on the wiki, like so:
Line 8: Line 8:


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

== Templates ==
Templates are wiki pages in the <tt>Template:</tt> namespace. They are designed specifically to be transcluded. A template can be transcluded in a shorthand way, rather than saying
<pre> {{:Template:welcome}} </pre> you can simply say <pre> {{welcome}} </pre>.

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.

Latest revision as of 17:35, 13 October 2008

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.