Help
Wiki Glossary
From Dogcraft Wiki
Templates
Templates are a consistent way to re-use text (or other content) across the wiki, regardless of what page your editing. Every template has a name, some content, and may have parameters, and a template's name is always the name of a wiki page in the Template:
namespace. When you add a template to a page, you only need to add its name (and any parameters), and when viewing said page, the template name will be replaced with whatever is on the Template:
page the name is pointing to. When editing the page, you will continue to see the template behave differently from the rest of the page.
In the VisualEditor, you can add templates using their own popup, in the top-bar at `Insert > Templates` by searching for the template's name. In the Source Editor, you can add a template by surrounding the template's name with two brackets like this: {{template name}}
.
For example, lets look at the "Egg" template. Here, the name of the template is (surprisingly :p) Egg, and it doesn't have any parameters. If you look at the Template:Egg page, you'll see the text "Eggs are great for breakfast.", that's the template's content. Adding the template on any page will show that sentence once you exit the editor. So, {{Egg}}
generates: Eggs are great for breakfast..
And if you were to change the text on the Template:Egg page to "Omelettes are great for breakfast.", then everywhere the Egg template is used would update automatically!
The contents of a template (whatever is on the Template:Template name
page) can have special sections of text called a parameter. Parameters are kind of like variables, they can be specified on the page that's using the template, kind of like an input. Parameters usually have their own names, and values. In the VisualEditor the template popup has a textbox for every parameter, while in the Source Editor, parameters can be added like this: {{template name|parameter_name = value|another_parameter_name = value}}
. Inside a template's content, it can refer to a parameter by its name, which when its added to a page will be replaced by its specified value. A template's content is always edited using the Source Editor. In there, parameters are marked by their name being surrounded with 3 brackets. (Eg.: {{{parameter name}}})
For example, lets look at the `Read more` template: Here, the name of the template is "Read more", it has 1 parameter called "name", and the content is "To read more about the topic, see the {{{name}}} page." If you wanted to use this template on a page, you could do Template:Read more to generate `To read more about the topic, see the Leon page.`