Wikishire:Templates: Difference between revisions
Created page with ''''Templates''' are a short way to add a repeated text or procedure within a page. It may be placed on the page or within another template. A template is written in the same ma…' |
Removing dead link and adding links to lists of templates |
||
Line 21: | Line 21: | ||
===Parameters=== | ===Parameters=== | ||
Templates can have parameters. Instead of just the template name, like <nowiki>{{foo}}</nowiki>, a template with parameters will have additional text, separated by vertical bars (|), for example <nowiki>{{foo|July|lc=yes}}</nowiki>. Here "July" is the value of the first unnamed parameter; "yes" is the value of the parameter "lc". Writing the template page for a template with parameters is more complicated than for a template with no parameters | Templates can have parameters. Instead of just the template name, like <nowiki>{{foo}}</nowiki>, a template with parameters will have additional text, separated by vertical bars (|), for example <nowiki>{{foo|July|lc=yes}}</nowiki>. Here "July" is the value of the first unnamed parameter; "yes" is the value of the parameter "lc". Writing the template page for a template with parameters is more complicated than for a template with no parameters. | ||
==Major examples of use== | ==Major examples of use== | ||
*[[Wikishire:Infoboxes|Infoboxes]] | *[[Wikishire:Infoboxes|Infoboxes]] | ||
*[[:Category:Bottom boxes|Bottom boxes]] | *[[:Category:Bottom boxes|Bottom boxes]] | ||
==Existing templates== | |||
*http://wikishire.co.uk/w/index.php?title=Special%3AAllPages&from=&to=&namespace=10 - complete | |||
*[[:Category:Templates]] - grouped by template type; manually linked and therefore not always complete | |||
==Further help== | ==Further help== | ||
Line 33: | Line 37: | ||
[[Category:Wikishire:Guides|Templates]] | [[Category:Wikishire:Guides|Templates]] | ||
[[Category:Templates| ]] |
Latest revision as of 06:13, 11 June 2016
Templates are a short way to add a repeated text or procedure within a page. It may be placed on the page or within another template. A template is written in the same manner as an article, but the page name begins "Template:", and on the edit screen the name (without "Template:") appears in double braces {{ }}
A basic template may be used to add a recurrant message to a page or a recurrant lay-out. Also though, a template may function as a programmed routine, or as a mixture of all three. A template may stand on its own or it may have "parameters", which make the template routine function differently according to the parameters given to it.
Editing and using templates
You start a new template in the same way you would start an article page. The only difference is that its title must start with Template:.
To add a Template to a page during editing, add {{templatename}} to the page on which you want to use it. If the Template needs parameters, do not forget to give it the parameters, for example:
{{port}} | Adds the category for a port in the relevant county. |
{{port|major}} | Gives it the "Major port" categories |
{{convert|8|km|mi|0|x}} | Has 5 parameters: it converts 8 from km to miles with 0 decimal places and omits (x) the metric measurement. |
Some templates have a "/doc" page attached to them to explain their use and the parameters they require.
When editing a template, remember that it will change every page on which the template appears.
Parameters
Templates can have parameters. Instead of just the template name, like {{foo}}, a template with parameters will have additional text, separated by vertical bars (|), for example {{foo|July|lc=yes}}. Here "July" is the value of the first unnamed parameter; "yes" is the value of the parameter "lc". Writing the template page for a template with parameters is more complicated than for a template with no parameters.
Major examples of use
Existing templates
- http://wikishire.co.uk/w/index.php?title=Special%3AAllPages&from=&to=&namespace=10 - complete
- Category:Templates - grouped by template type; manually linked and therefore not always complete
Further help
For help on programming templates, look initially at: