Help:Templates

From 118Wiki
Jump to navigation Jump to search

Templates are a way to include commonly reused segments of text or code. They also make pages sources easier to read by removing complicated elements.

Example

For instance adding {{Template:NPC ship}} to a page makes it add this:

Non-Starfleet NPC Vessels
Edit Listing

SS Andraste · Astrolabe . Crystal Star III · Eagle's Eyrie · SS Evangeline · FTS: ( Asterospolis · K'roc · K'tarn · Marauder · P'Kothla · Serapis · Treasure Sprite ) · Furies Furnace Base · Hawkeye · SS Idril Mar · Labyrinth's Scream · SS Lady Adventure · Midway Station · Rihac Gorshun · SS Shining Star · Skiptrace · Southern Cross · SS Tanandra · Te'Lir

StarBase 118 Fleet Active Vessels Inactive Vessels Lost or Decommissioned Vessels
NPC Ships

This is a reasonably large segment of code, that would be inconvenient to add to many pages that require it, so it as added as a template in order to make it easier.

Guidelines

Before we talk about how to make Templates, it is a good idea to consider when we should use templates.

  1. Templates should only be used for code which is likely to be re-used on a number of pages.
  2. Templates are unnecessary for short segments.

For instance using a template to include a universal navigation for a set of pages in a series is a good use, while creating a template for the "Stats" segment on your characters page is unnecessary.

How to create a template

A template can be created in the same way as a ordinary page, just instead of just typing the pages name you type Template: before it to mark it as a template.

More help on templates