Templates

From mw.mh370.wiki
Jump to navigation Jump to search


A Guide to Using MediaWiki in a Hosted Environment

An instructional website by the developer of mh370wiki.net - a MediaWiki site about Malaysia Airlines Flight MH370.


Templates are stored in the Template namespace, or NS_Template:

Templates are intended to be transcluded. When using a template it is not necessary to prefix the template name with the template namespace.


Templates and the mh370wiki.net website

Templates have been developed for many purposes, separated here into simple and complex examples:-

Simple Templates

Templates with no variables. The content is transcluded just as it is stored. Some examples are:-

  • Dates are displayed by templates stored as a Day Number.
    For example, Day 001 in the story of flight MH370 is Saturday, 8 March 2014. Throughout the website day numbers have been used and the corresponding dates have been transcluded from the Template nmamespace.
  • Page headers and footers. Standardised text is stored as templates and re-use ensures consistency.
  • Menus and Buttons. Each button, and each button state, is stored as a template. Buttons are transcluded into Menus. Menus are transcluded into pages.
  • Abbreviations. Within the website there are many references to the final Report. Instead of writing the report name each time, a template is used instead. Two version of the report name are frequently used:-
    1. A short form, transcluded as {{SIR2018/Ref}} which returns Safety Investigation Report MH370/01/2018, and
    2. A long form, transcluded as {{SIR2018/FullRef}} which returns Malaysian ICAO Annex 13 Safety Investigation Team for MH370, 02 July 2018, Safety Investigation Report MH370/01/2018

    To reference a specific section, the instruction written with the template says:

    <p>To use this reference use the following syntax:-</p>
    
    <p><u>Source</u>: {{SIR2018/Ref}} [[Section N.n|Section N.n]] </p>
    

See also: Simple Templates.


Complex Templates

These templates include variable parameters. Each parameter is enclosed by triple brackets {{{ and separated by the pipe symbol |.

The format is explained in the MediaWiki article Help:Templates

For each of these templates there are two parts:-

  1. The actual template, which is the code required to format and present the information on a page, and
  2. An instruction, which explains how the template is used and includes the code to be placed on a page to get the template to work.

Without the saved instructions, the template would become useless because I would forget why it is written the way it is, and how to actually implement it.

In addition, there may be variants of the template for different contexts.

For example, each page in the Passenger namespace provides known information about each person on-board the ill-fated flight MH370. For each passenger we have several variants of a passenger manifest or seating plan. Some passengers had public or social media profiles which were tapped by mainstream media to create the human interest stories related to the flight. Some of the media reports included photograps, often extracted from social media pages.

So

  • every passenger has basic information collated from official passenger manifests
  • some passengers have additional information or profile provided by mainstream media
  • some mainstream media profiles include a photo.
  • For some passengers, additional notes have been created. For example those travelling on stolen passports.

Subpages in the Template Namespace

The default setting is that subpages are not allowed in the Template namespace. However, I find it useful to create variants of a template as subpages of an instruction page in the Template namespace.

For example, passenger templates are subpages, named like this:-

  • Passenger/Summary - this is the basic template for those with minimal data
  • Passenger/Media - for passengers with basic plus media profile
  • Passenger/Image - for passengers with basic plus media profile including an image

And three more variants:-

  • Passenger/Summary/Notes - for passengers with minimal data but additional clarification necessary with notes added
  • Passenger/Media/Notes - for passengers with basic plus media profile and additional clarification necessary with notes added
  • Passenger/Image/Notes - for passengers with basic plus media profile including an image and additional clarification necessary with notes added

This might seem complicated but remember, there were 227 passengers on-board. The goal is to present relevant information in a consistent format.

An extract from the Template for Passenger/Media/Notes is shown below. The menu and page background is not included.

<html> <details open> <summary></html>{{PAGENAME}}<html></summary> </html>
 <div style="margin-left:2.5em;">{{{Summary| }}}</div>
<html> </details> </html>

<html> <details> <summary>Media Sources</summary> </html>
 <div style="margin-left:2.5em;">{{{Media| }}}</div>
<html> </details> </html>

<html> <details> <summary>Passenger Manifest Data</summary> </html>
 <div style="margin-left:2.5em;">{{{Manifest| }}}</div>
<html> </details> </html>

<html> <details> <summary>Notes:-</summary> </html>
  <div style="margin-left:2.5em;">{{{Notes| }}}</div>
<html> </details> </html>

Instructions for using this template looks like this:-

{{Template:Passenger/Media/Notes
   |Summary={{Pass_Data:{{PAGENAME}}/Summary}}
   |Media={{Pass_Data:{{PAGENAME}}/Media}}
   |Manifest={{Pass_Data:{{PAGENAME}}/Manifest}}
   |Notes={{Pass_Data:{{PAGENAME}}/Notes}}
}}

And that's all there is on every page where the available information about a passenger is based on the passenger manifests, plus one or more extracts from the media, plus an explanatory note.

All of the information presented is automatically transcluded from associated pages in the hidden namespace, written here as Pass_Data, where each page has the same name so that PAGENAME links to the correct page, and sub-pages hold the data to be transcluded. But there may be additional content on each sub-page which is not transcluded.


See also: Complex Templates.

Links

Help:Templates
https://www.mediawiki.org/wiki/Help:Templates
Transclusion
https://www.mediawiki.org/wiki/Transclusion



Articles which relate to MediaWiki Templates

Articles which relate to MediaWiki Templates are included in Category:Templates.

The CategoryTree Extension enables a listing of relevant sub-categories and pages:-