Wiki templates: Difference between revisions
TOstryzniuk (talk | contribs) mNo edit summary |
Ttenbergen (talk | contribs) 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]]. | ||
[[Category:Wiki | [[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.