Help:Templates
Templates are special pages which provide a format for similar information displayed on multiple pages. Essentially, you can create a page in the Template namespace and then include it on other pages; when the template changes, the other pages will automatically change. Additionally, you can pass information from a page to a template to control its appearance.
If you've used templates on Wikipedia, you already know how this works: the syntax is exactly the same. You might want to read up on Lingua (Povo's scripting language) and search templates for new ways of creating and using templates.
You can create a new template by just creating a page in the Template namespace. You can then include the text of that page on any other page by using double braces: {{
TemplateName}}. When the page is displayed, {{
TemplateName}} will be replaced with the text of the template. This is known as "calling a template".
If there are template calls on a page, you will see a "Templates" tab while editing it which lists all the templates in use. If you edit a page and can't find the text you'd like to change, it's most likely contained in a template.
You can make template calls even if the template doesn't exist. In this case, the template will render as red text to indicate that it hasn't been made yet. To see a list of these "missing template uses," you can use the
Broken Templates page.
Templates in different regions
Templates can be region-specific (regions are things like
Boston or
Somerville). If you create a template on www.povo.com, it is available to all regions in Povo. If you create a template in a specific region, it will only be available to pages within that region or any child regions. When you call a template, Povo first looks to see if the template exists in the region of the page you're calling from. If it doesn't, Povo looks for the template in the root region. This allows you to create templates that override the default templates for a particular region.
You can also pass parameters into a template call to change how it renders. This is done by appending a pipe to the template name and then providing a pipe-delimited list of name-value pairs. This is easier to see in an example:
{{TemplateName|Parameter1=foo|Parameter2=baz}}
In this case, the template named "TemplateName" will be called, and two parameters ("Parameter1" and "Parameter2") will be passed in with the values "foo" and "baz", respectively. The TemplateName template can now use parameters using a triple-brace syntax. If the text of TemplateName were:
This is parameter 1: {{{Parameter1}}}
This is parameter 2: {{{Parameter2}}}
Then the output of the above template call would be:
This is parameter 1: foo
This is parameter 2: baz
Template calls don't need to be constrained to a single line, as in the above example; in fact, they're usually easier to read when broken up:
Template:TemplateName
The <noinclude> template call renders the enclosed information only on the template's editing page. This is useful for providing additional information about creating and using a template. For example,
<noinclude>
This is help text
</noinclude>
"This is help text" will not be rendered when the template is included, but will appear on the page [[template:templatename]]
Povo templates differ from Wikipedia templates mainly by the inclusion of a scripting language to control rendering.
You use Lingua in a template by embedding Lingua tags that contain code; if you've used PHP or ASP, it's very similar. A Lingua tag starts with <% and ends with %>; everything in between is interpreted as Lingua code. So, for example, you could make a template with the following Lingua code:
<% if Parameter1 = "blue" %>
The first parameter was the color blue
<% else if Parameter2 = "red" %>
The first parameter was the color red
<% end %>
Then, if you called the template with {{TemplateName|Parameter1=blue|Parameter2=orange}}, you would see the following output:
The first parameter was the color blue
You can read more about Lingua syntax
here.
See some of the most popular templates
here.
Thank you for your contribution. You've taken a huge step to making Povo the "word on the street,"
and we appreciate it very much. Because of the complexity of the "wiki text" and code that can be used
on Povo, in order to edit this section in the future you must click the "edit" button to the right of the section
heading (or for the whole page).