Help:Creating templates

From Conservapedia
This is an old revision of this page, as edited by Ed Poor (Talk | contribs) at 00:53, May 27, 2007. It may differ significantly from current revision.

Jump to: navigation, search

NOTE: Some of the information in this page is intended as a proposal but will become policy if there are no objections.


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.

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}} which looks like this:
! This Is An Original Work.
This Essay is an original work which represents the views of its author or authors and does not necessarily represent the views of Conservapedia or its management.
Conservlogo.png
  • 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.

Documenting templates

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

They must be documented in two places:

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>{{/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.

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=}}
{{Parms|
{{Parm|name|optional? (yes/no)|purpose|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.