Help:Creating templates

From Conservapedia

Jump to: navigation, search

A template is a page that can be inserted in another page. Although any page can be inserted in another page, templates are normally created in the "Template" namespace.



Contents

Before you can attach your own template to any CP page, you will need to submit it for approval at Template Submission.

Creating templates

Templates can be created (started) in exactly the same way as ordinary articles. See How to create a new article.

Types of templates

Statistics
Matlab 3dplot.jpg
Major approaches
Frequency probability
Bayesian inference
Non-parametric statistics
Common methods
Analysis of variance
Chi-Square test
Students t-test
Z test
Linear regression
Bayesian model selection
Bootstrapping

Templates can be categorised into three types:

  • Boilerplate text. These templates are simply some predefined text that can be inserted into articles. An example is {{essay}}.
  • List of links. Many templates might includes links to other articles. Templates consisting solely of links are usually referred to as navigation boxes, because they allow you to jump to related articles. And example is {{statistics}} which is shown at right.
Victory
Career
Characteristics
Length 226 feet
Beam 52 feet
Draft 29 feet
Speed 8-9 knots
Armament 104 guns on 3 decks
Crew 850
  • With parameters. These templates are designed to have values passed to it to include different information in the same basic layout. Info boxes are one type of such template. The example at right is an information box for a ship, with the details of the ship passed as parameters like this: {{Ship|name=Victory|disp=3,500 tons|length=226 feet|beam=52 feet|draft=29 feet|speed=8-9 knots|armament=104 guns on 3 decks|crew=850}}
    There are several different options for parameters:
    • Parameters can be required or optional. Optional parameters often require more effort by the editor creating the parameter, but less effort by the editor using the template.
    • Parameters can be named or not named. Named parameters are more flexible (they can be supplied in any order, and any optional parameters can be omitted), but require a bit more typing by the editor using them. Unnamed parameters must be supplied in order, and only parameters at the end of the list can be omitted.
    • You can have a mix of named and unnamed parameters.

Templates can be designed to change their appearance depending on the parameters supplied. For example, the {{ship}} template above could have been designed to not show the "Test depth" row of the table when no parameter was supplied for that field.

Writing templates

It is not the purpose of this page to describe the various ways to write templates. See the template manual at MediaWiki.

Creating parameters for templates

{{{1}}} creates a parameter for a template

{{{1|car}}} creates a parameter for a template whose default is car

{{{myage}}} creates a parameter named myage for a template

{{{myage|car}}} creates a parameter named myage for a template whose default is car


named parameters for example {{myage}} versus {{{1}}} or {{{2}}} or {{{3}}} do not have to be put in any particular order


for example let us say there is a template called Template:User age, that looks like this, {{{1}}} is my age

you would put {{User age|12}} for the template to display, 12 is my age


another example let us say there is a template called Template:User age, that looks like this, {{{1}}} is my age, I was born in the month, {{{2}}}

you would put {{User age|12|December}} for the template to display, 12 is my age I was born in the month December


another example let us say there is a template called Template:User age, that looks like this, {{{myage}}} is my age

you would put {{User age|myage=19}} for the template to display, 19 is my age


another example let us say there is a template called Template:User age, that looks like this, {{{myage}}} is my age, I was born in the month, {{{mymonth}}}

you would put {{User age|myage=19|my month=January}} for the template to display, 19 is my age, I was born in the month, January you also could put {{User age|my month=January|myage=19}} for the same result

Documenting templates

Templates existing on Conservapedia must be documented, or they will be deleted.

They must be documented in two places:

There are some exceptions to this rule:

  • User boxes do not have the same requirements. See further below.
  • Some articles have a sub-page transcluded into the article as a template, even though not in template namespace. These should only be used if the sub-page is transcluded into the one (parent) article. If they are to be used in more than one place, they should be in template namespace. These do not need to be documented.
  • Conservapedia does not allow signature templates. However, this does not preclude having a signature template which is substituted into another page. It is transclusion that is not allowed. As the template is only for use by a single person, it does not need to be documented.

Documentation on the template page

To include documentation on the template page, include it between <noinclude> tags. Anything between <noinclude> tags will appear on the template page but is not part of the template, so will not appear on pages that the template is placed on. There are three ways to put the documentation on the page:

  1. Write the full documentation.
  2. Put a link to another page which itself contains the documentation.
  3. Write the documentation on another page (usually a sub-page), and include that other page on the template page using the template syntax. For example: <noinclude>{{<template-name>/doc}}</noinclude> will place the contents of the "doc" sub-page of the template on the template page itself.

Methods 2 and 3 are useful if the template itself is locked from editing, as it still allows the documentation itself to be edited by any editor.

The following two templates should be placed on the documentation page of all templates. In some cases, these two templates are all that is required, but often other information should be added also.

  • {{TemplateDoc}} This is a brief description of the template.
  • {{Parms}} This is a container for a list of parameters. If there are no parameters, just place {{Parms|}} on the page.
  • {{Parm}} This comprises the details of a single parameter. Use one of these for each parameter in the template, with all of them comprising the one parameter required for the {{Parms}} macro.
    • Note that in a few cases with many straight-forward parameters which are obvious from the template itself, it is not necessary to list each one of them individually. See {{planet}} for an example.

To make it easier, simply copy the following text to the documentation page of a template, then fill in the details. If you are not placing this on the template page itself, omit the <noinclude> tags.

<noinclude>
{{TemplateDoc|pages=|purpose=|cat=}}
{{Parms|
{{Parm|name|purpose|required? (yes/no)|Comment (may be default value)}} <!-- Replace the fields here with your own values -->
{{Parm||||}} <!-- use as many "Parm" macros as the template has parameters -->
}}
</noinclude>

Documentation in the template list

All templates must also be included in the template list for easy reference. To include your template in this list, locate the appropriate section and list your template in alphabetical orders using the format * {{tl|your template name}} description. The description is a brief description of what the template is for, including mention of parameters.

User boxes

User boxes, although also templates, do not need to be documented in the same way.

They should be listed on one of the lists of user boxes. See Userboxes for more information.

They do not otherwise need to be documented (their purpose and use is obvious), except when they have parameters, in which case they should include the {{Parms}} template.

Locking of templates

Conservapedia sysops will try to leave templates unlocked, but templates that are used on many pages are prime candidates for vandalism and will be locked accordingly. If you wish to edit a locked template, contact any sysop who will unlock it for you for a brief time, but only if you have an established record of editing on Conservapedia. Alternatively, propose your changes on a talk page and ask a sysop to make the changes for you.

Personal tools