Help:Templates

From 68kMLA Wiki
Jump to: navigation, search

Begin by reading Meta's basic and advanced documentation.

Variable templates

The advanced templates page mentions this, but the example is not very helpful. Looking at the implementation used in Wikipedia's Polyhedra DB template is much more informative.

Usage within 68kMLA Wiki

We use variable templates for hardware specs. The individual machine templates should contain all the fields in {{Computer specs full}}. That one is our definitive "full display" version. Other "meta templates" that can be used for display are {{Computer specs row}} (for tables) and {{Computer specs infobox}} (summary for the top of the page).

How it works

Putting data in a template lets it be easily reused in multiple places. However, those multiple places may wish to format that information differently. By making the first template itself call a second template, you can reuse the same data but with a different format, achieving the objective. For example:

{{ Macintosh Quadra 605 specs | computer specs infobox }}

This will insert the {{Macintosh Quadra 605 specs}} template, which contains the Q605 data, into the page. This template looks like this:

{{ {{{1}}}
 |name=Quadra 605
 |form-factor=desktop
 …
 }}

The {{{1}}} is replaced with "computer specs infobox", so the end result is that you are including this:

{{ computer specs infobox
 |name=Quadra 605
 |form-factor=desktop
 …
 }}

That gives you the formatted version you want.