Wiki templates: Difference between revisions

From CCMDB Wiki
Jump to navigation Jump to search
TOstryzniuk (talk | contribs)
mNo edit summary
TOstryzniuk (talk | contribs)
mNo edit summary
Line 12: Line 12:
I used this for the [[Template:contact]] template, which is used for contacts such as for [[Tina Tenbergen]].
I used this for the [[Template:contact]] template, which is used for contacts such as for [[Tina Tenbergen]].


To use a ''template'' that has already been set up, go to: [[:Category: Used Templates | templates currently use]]___[[User:TOstryzniuk|TOstryzniuk]] 22:44, 1 February 2009 (CST)
To use a ''template'' that has already been set up, go to: [[:Category: Used Templates | templates currently in use]]__[[User:TOstryzniuk|TOstryzniuk]] 22:44, 1 February 2009 (CST)


[[Category:Wiki Usage]]
[[Category:Wiki Usage]]

Revision as of 22:46, 1 February 2009

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.

To use a template that has already been set up, go to: templates currently in use__TOstryzniuk 22:44, 1 February 2009 (CST)