Battlestar Wiki:Template List Guidelines: Difference between revisions

From Battlestar Wiki, the free, open content Battlestar Galactica encyclopedia and episode guide
m (Battlestar Wiki:Template List/Guidelines moved to Battlestar Wiki:Template List Guidelines: just going to make this it's own page.. :))
(Added french interwiki link.)
 
Line 63: Line 63:


All templates that are supposed to be <code>subst:</code> should have '''<nowiki><noinclude></nowiki>{{tl|TemplateSubst}}<nowiki></noinclude></nowiki>''' to display any user that the template ''has'' to be subst: because it's not a common template and it really doesn't need to be updated once it's added. (i.e. The day can change.)
All templates that are supposed to be <code>subst:</code> should have '''<nowiki><noinclude></nowiki>{{tl|TemplateSubst}}<nowiki></noinclude></nowiki>''' to display any user that the template ''has'' to be subst: because it's not a common template and it really doesn't need to be updated once it's added. (i.e. The day can change.)
[[fr:Battlestar Wiki:Manuel (Modèles)]]

Latest revision as of 20:02, 22 January 2009

Parent Page: Battlestar Wiki:Template List

What are Templates?

Templates are pages that are created with two { on either side of the template name. {{interview}} is a perfect example of how a template is created. They are used to process and show a message over a number of pages without having to retype the information over again and allows quick updating. All you would have to do is update the template and all the pages contacting with that template.

Template Syntax

When you create most templates you can just have them posted. Some don't have any options. but others have tons of options (i.e. {{cite web}}). But as soon as you get complicated templates with lots of options, it is best to keep the syntax simple and easy to understand if you ever had to do any templates. Some of them have options that are only needed on certain pages and some things on a template should only be on the template. This pages is to tell you how to do that.

A few things you know first is that there are a few template related syntax HTML tags that you should know before going any futures.

  • <includeonly><includeonly>
    • Any code/text in between these tags will only get displayed if the template itself is rendered.
  • <noinclude><noinclude>
    • Any code/text in between these tags will only be processed in the template page itself and never will be passed on when rendered.

ParserFunctions

Using ParserFunctions is the only way to do comparisons. Mathematical templates have been imported from Wikipedia to help with complex math operations in template. if you use any of the ParserFunctions in any part, please add <noinclude>[[Category:Templates using ParserFunctions|{{PAGENAME}}]]</noinclude> to document the templates that are using this template.

Live Example

The best example on this Wiki is the {{cite web}} template as it's very complex. If you view the template why you read it would be good so you can compare on what stuff does.

Part 1: Code

Has the actual template code. It is all increased with <includeonly> because there are required options for the template and if it was formated, it would return an error and we don't need to show that to a user who is trying to see how to use a template.

Part 2: Documentation

States the general purpose of the said template and how it should be used and where it should be used.

Part 3: Full Syntax Use

Should be how to use the template fully, no matter what the options are so the user knows what options are needed. In this should also carry the minimum section always showing the user what are the minimum fields required for use so the user can copy the syntax and paste it where they needed. Another section should be a "most common" fields that are used for the template.

Part 4: Explain the fields

Though this is the most section, this section should have two subparts. Required and Optional parts. Other parts might exist if they might seem to the relevant template. See {{Episode Data}} for a perfect example.

This section should be filled out like this:

  • parent
    • child — may be used with parent (and is ignored if parent is not used)
    • OR: child2 — may be used instead of parent (and is ignored if parent is used)
      • AND: child3 — may be used with parent and child (ignored if not filled out)

If the field name is bold, this is usually a field that is required, but if it is italicized it's a description of the child fields. OR means that it can be used but not required. AND means that the field is needed in addition to it's parent in the list.

Required

This section has to at least exist. There is no excuse for this not to exists.

Optional

This section is for the optional fields.

<noinclude>

Parts 2 - 4 have the <noinclude> encased in them so they will not show up when the template is rendered.

Subst: templates

All templates that are supposed to be subst: should have <noinclude>{{TemplateSubst}}</noinclude> to display any user that the template has to be subst: because it's not a common template and it really doesn't need to be updated once it's added. (i.e. The day can change.)