Wiki templates: Difference between revisions

From CCMDB Wiki
Jump to navigation Jump to search
TOstryzniuk (talk | contribs)
mNo edit summary
m Text replacement - "Wiki Usage" to "Wiki use"
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
To find a list of ''templates'' that are currently used on our wiki, see [[Special:Templates]].
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 <nowiki>{{the manager}}</nowiki>, 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 <nowiki>{{TableTemplate}}</nowiki> and write <nowiki>{{subst:TableTemplate}}</nowiki> in your document and save it. Pop - an empty table appears.  
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 <nowiki>{{the manager}}</nowiki>, 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 <nowiki>{{TableTemplate}}</nowiki> and write <nowiki>{{subst:TableTemplate}}</nowiki> in your document and save it. Pop - an empty table appears.  


Line 10: Line 12:
It would display as  
It would display as  
  <nowiki>My name is Bob and I am a Lumberjack.</nowiki>
  <nowiki>My name is Bob and I am a Lumberjack.</nowiki>
I used this for the [[Template:contact]] template, which is used for contacts such as for [[Tina Tenbergen]].
I used this for the [[p:Template:contact]] template, which is used for contacts such as for [[p:Tina Tenbergen]].
 
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 use]]

Latest revision as of 11:06, 27 September 2018

To find a list of templates that are currently used on our wiki, see Special:Templates.

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 p:Template:contact template, which is used for contacts such as for p:Tina Tenbergen.