Wiki templates

From CCMDB Wiki
Revision as of 15:20, 28 March 2008 by Ttenbergen (talk | contribs) (New page: You can use templates for elements that crop up repeatedly. Templates can either be "transcluded", meaning they get pulled in at the time the page is viewed, or they can be "subst"ed, mean...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

You can use templates for elements that crop up repeatedly. Templates can either be "transcluded", meaning they get pulled in at the time the page is viewed, or they can be "subst"ed, meaning they get copied in upon the first time a document calling them is saved. Transclusion is useful for instances such as referring to {{the manager}}, where you can save the name as a template so you can make all changes in one place. Subst is usefull if, for example, you find the syntax for a table difficult to remember and want to be able to just drop it into a page you are creating, and then fill in the blanks. Just save a reasonably sized table as {{TableTemplate}} and write {{subst:TableTemplate}} in your document and save it. Pop - an empty table appears.

To make a template is just like making any normal page, but you precede the name with "Template:" when saving it, e.g. Template:TableTemplate.

As a further trick, templates can pull in variables. If you saved

My name is {{{1}}} and I am a {{{2}}}.

Into a template "occupation", and then called the template as

{{occupation|Bob|Lumberjack}}

It would display as

My name is Bob and I am a Lumberjack.

I used this for the Template:contact template, which is used for contacts such as for Tina Tenbergen.