Wiki Templates: Difference between revisions

From Drunkapedia
Jump to: navigation, search
imported>Tlosk
imported>Tlosk
Line 50: Line 50:
* {{tl|Post}} - Formatting for an individual post with indenting, can be used on talk pages or the [[Forum]].
* {{tl|Post}} - Formatting for an individual post with indenting, can be used on talk pages or the [[Forum]].
* {{tl|Sold By}} - Creates a whatlinkshere link for items that are sold by one or more vendors, for use in the Notes section (use even when a single vendor since it will automatically update if more vendors are added in the future).
* {{tl|Sold By}} - Creates a whatlinkshere link for items that are sold by one or more vendors, for use in the Notes section (use even when a single vendor since it will automatically update if more vendors are added in the future).
* {{tl|Strip}} - Remove (trim) leading and trailing white space from a variable.
* {{tl|tl}} - Links to a wiki template showing the name surrounded by curly braces, for use on instructional/help pages.
* {{tl|tl}} - Links to a wiki template showing the name surrounded by curly braces, for use on instructional/help pages.
* {{tl|mtl}} - Nonlink for a wiki template showing the name surrounded by curly braces (used as a parameter that will be turned into a link, such as for {{tl|Related}}.
* {{tl|mtl}} - Nonlink for a wiki template showing the name surrounded by curly braces (used as a parameter that will be turned into a link, such as for {{tl|Related}}.
Line 73: Line 74:
* {{tl|Ingredient}} - Stats panel, with optional recipe option, for (Cooking) Ingredients.
* {{tl|Ingredient}} - Stats panel, with optional recipe option, for (Cooking) Ingredients.
* {{tl|Item Table}} - Displays a bulleted list of items in a borderless table four across with their icons.
* {{tl|Item Table}} - Displays a bulleted list of items in a borderless table four across with their icons.
* {{tl|Inventory Item}} - An item within an Inventory Table (icon, name and price).
* {{tl|Inventory Table}} - Used on Shopkeeper NPC pages to list the items sold by the shopkeeper (icon, name, and price).
* {{tl|Jewelry}} - Stats panel and live image as part of the [[Jewelry Template]].
* {{tl|Jewelry}} - Stats panel and live image as part of the [[Jewelry Template]].
* {{tl|Key}} - Stats panel and live image as part of the [[Key Template]].
* {{tl|Key}} - Stats panel and live image as part of the [[Key Template]].

Revision as of 19:20, 11 May 2009

Related topics: Page Templates, Wiki Markup Reference

List of wiki templates that are used in formatting areas/items that recur frequently across different pages. Their purpose is two-fold, to make using advanced formatting simpler and to allow formatting changes in the future with a single edit (so you don't have to go back and reedit all the pages that use the template). Templates are not only convenient, but they can also "force" a useful uniformity. Some templates are simple and do not require any parameters but most do. If you're new to the term parameter or argument passing in general, a more complete description is given below.

Note: Wikipedia and many other wikis use lower case or first letter upper case (e.g., "Wiki templates" or "wiki templates") in naming articles, templates, images, etc. However due to the specialized nature of ACC Wiki wherein it holds only content related to Asheron's Call, title case is the default for naming because that is what is used in game.

List of Templates

More information for each template can be found by clicking on the template name.

Maps

  • {{Spawn Map}} - Formats preexisting map of spawn locations. See Spawn Map for additional information.
  • {{Map Point}} - Displays a location on a small map of Dereth given specific coordinates, up to 4 points can be displayed on the same map.
  • {{Map Point Plus}} - Displays up to 30 locations on a large map of Dereth given specific coordinates. The markers on the map can be individually customized for each point, including a popup description.

Table of Contents

  • {{LeftToC}} - Table of contents appears on left side with text wrapping along the right.
  • {{RightToC}} - Table of contents appears on right side with text wrapping along the left.
  • {{Quest Links}} - Placed in quest summary header provides ToC like links to the major sections of a quest writeup.
  • {{Exemplar ToC}} - Floats an exemplar image and Table of Contents on the right (text will wrap on the left).

Navigation

Quotations

Archive of Internet Article

See Archive of Internet Article Template for an examples.

  • {{Turbine 2008}} - Archived internet articles from Turbine's website following the redesign in August 2008 (ac.turbine.com)
  • {{Turbine 2005}} - Archived internet articles from Turbine's website between the redesigns in July 2005 and August 2008 (ac.turbine.com).
  • {{Turbine Games}} - Archived internet articles from Turbine's new website between 2003 and the redesign in July 2005 (ac.turbinegames.com).
  • {{Microsoft Games Insider}} - Archived internet articles from Microsoft Games (microsoftgamesinsider.com).
  • {{Microsoft Games}} - Archived internet articles from Microsoft Games (microsoft.com/games/zone/asheronscall/).
  • {{Microsoft Zone}} - Archived internet articles from the Microsoft Zone (zone.com/asheronscall/).
  • {{Zogblaster}} - Archived internet articles from Turbine's pre-release pages before Nov 1999 (zogblaster.com/tweb/asherons-call/).

Elements

Rudimentary components used within many other templates/types of pages.

  • {{!}} - Alias for a pipe ( | ) when used within a parameter list for a wiki template.
  • {{=}} - Alias for an equals sign ( = ).
  • {{Icon}} - Displays Icon, enforces Naming Conventions and sets the Icon popup caption to the item name rather than the full image file name.
  • {{Locations}} - Creates a whatlinkshere link for creatures and items, for use in the Notes section.
  • {{Post}} - Formatting for an individual post with indenting, can be used on talk pages or the Forum.
  • {{Sold By}} - Creates a whatlinkshere link for items that are sold by one or more vendors, for use in the Notes section (use even when a single vendor since it will automatically update if more vendors are added in the future).
  • {{Strip}} - Remove (trim) leading and trailing white space from a variable.
  • {{tl}} - Links to a wiki template showing the name surrounded by curly braces, for use on instructional/help pages.
  • {{mtl}} - Nonlink for a wiki template showing the name surrounded by curly braces (used as a parameter that will be turned into a link, such as for {{Related}}.

Miscellaneous

Parameters

A parameter, or argument, is information that the template needs to complete its job. If a parameter is required, you must include it, if it is optional you can omit it if it doesn't apply. For example if someone gives you a to do list, the purpose of the list is clear, you are supposed to do the items on the list. But for any given list, the items will differ. A template that requires parameters is the same idea. Parameters are separated with single pipes ( | ). If you need to include a pipe as part of a parameter use {{!}}. Here's an example of formatting a to do list with three items using the fictional ToDoList template:

{{ToDoList|Buy milk.|Return videos.|Wash car.}}

How the list is formatted will depend on exactly how the actual template is setup, but here is one possibility:

To Do List


  1. Buy milk.
  2. Return videos.
  3. Wash car.

Named Variables

Unlike the ToDo list above where all the parameters are things to do, most templates that use parameters give each one an explicit name. This is needed when the parameters are formatted differently or put in particular locations.

An example would be a business card template. The phone number, address, name, etc all go in particular locations and so the template needs to know which parameter is the name, which is the address, etc.

For example:

{{Business Card
| Name = Martine Strathelar
| Address = 100 Planar Drive, Dereth
| Business = Temporal Translocations
| Phone Number = 555-555-1212
}}

which using the hypothetical Business Card template might be displayed as:


Martine Strathelar


Temporal Translocations


100 Planar Drive, Dereth - (555)555-1212

Whitespace

Whitespace (including newlines, tabs and spaces) is stripped from the beginning and end of all parameters. If this is not desirable, adding any non-whitespace characters (including the HTML encoding for a whitespace character, or invisible Unicode characters such as the zero-width space or direction marks) will prevent further stripping:

{{#ifeq: foo            |            foo | equal | not equal }}
equal
{{#ifeq:  foo            |            foo  | equal | not equal }}
not equal

Judicious use of whitespace can make templates more readable, quicker to fill out, and easier to debug when unexpected behavior occurs. Compare the two uses below that would have identical results.

{{Template
 |   Parameter One = One
 |   Parameter Two = Two
 | Parameter Three = Three
 |  Parameter Four = Four
}}

{{Template|Parameter One=One|Parameter Two=Two|Parameter Three=Three|Parameter Four=Four}}

Advanced Template Syntax

To use templates you won't need to know any of the following, however in order to edit an existing template or to create a new template you may find this information useful. Additional info can be found at Help:Template and Help:Advanced templates (Wikipedia, so the information may not always apply exactly to this installation of Wikimedia software). You cannot preview changes to a template, so to avoid having broken templates for other users, test changes or new templates in the Template:Sandbox. (Don't forget to change your template's name to {{Sandbox}} to see the effects in the Sandbox.) Once it is working how you expect it to, transfer the code to the actual template page and revert the Sandbox.

Syntax

  • <includeonly></includeonly> - Optional tags you can place around the workhorse code that defines what the template does. It will cause the code to not display on the template page, improving the appearance of the page since most variables will be undefined. Also it will not compete with an example in situations where only one of an item can be displayed, such as a table of contents.
  • <noinclude></noinclude> - Anything between these tags will be processed and displayed only when the page is being viewed directly; it will not be included or substituted in normal usage when the template is being referenced.
  • {{{1}}} - The first unnamed variable (parameter) from the template invocation. That is, on another page where {{Related|Weapons|Armor|Loot}} is used, Weapons would be the first unnamed variable. Increment the number for successive variables, for example {{{3}}} would reference the third unnamed variable (Loot). Where this term ({{{1}}}) is used in your template, the variable's value will be inserted. So if [[{{{1}}}]] is in your template, it will be show up as Loot on the page where you used the template.
  • {{{1|}}} - You can declare a default value for any variable by inserting a pipe and a default value. If the variable is undefined the default value will be given instead. For example, if the template uses {{{1|''No Link''}}} then if no value was passed, it will be assigned "No Link."
  • {{{Variable}}} - A named variable has an explicit name assigned with the equals sign when using the template. For example, on the page using the template you could have {{Business Card|Name=John Doe}}. This would mean that for the template "Business Card" the named variable "Name" has a value of "John Doe" and when using this on the actual template page you would use {{{Name}}} to reference this variable's value (John Doe).
  • {{{Variable|}}} - As described above for {{{1|}}} you can also set a default value for named variables. This can be useful for templates where you will usually use a standard value but want to retain the option of specifying a value. When using the default, just leave out the variable. For example, {{{align|center}}}. This would still let you set align=right or align=left when using the template, but if you don't use align at all, it will be center. Keep in mind if align is left blank (align = ) then the default will not be used because the value is an empty string. In other words there are three possibilities, in the example below align has a value of "top," margin has an empty value, and style is absent and would use the default value if one is given for the style variable:
{{Template
 | align = top
 | margin = 
}}
One way around this that would handle both situations (completely absent and just a blank value) would be to use {{#ifeq:{{{align|}}}||<value if absent or blank>|<value if present and nonblank>}}. This comparison sets an empty string as the default, so if it is either not present or blank it will lead give the same result.
  • -

Parser and Variable Functions

  • #if: - {{#if: test string | value if true | value if false}}
  • #ifeq: - {{#ifeq: string 1 | string 2 | value if true | value if false}} - Compares string 1 with string 2 to see if they are equal.
  • #ifexist: - {{#ifexist: page title | value if exists | value if doesn't exist }}, can be used for articles or files (images).
  • #expr: - {{#expr: expression }} - Mathematical operations. Details
  • #vardefine - {{#vardefine: variablename | value }} - assigns variable
  • #vardefineecho - {{#vardefineecho: variablename | value }} - assigns and prints variable
  • #var - {{#var: variablename }} - prints current value

Request a Template

If you would like a template made but aren't sure how to go about adding one, Tlosk or Widgeon can probably help you.