GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Main page
  • Get MediaWiki
  • Get extensions
  • Tech blog
  • Contribute
  • User help
  • FAQ
  • Technical manual
  • Support desk
  • Communication
  • Developer portal
  • Code statistics
  • Community portal
  • Recent changes

This view

  • Original page
  • New address

GeezerVison is showing www.mediawiki.org — Help:Multiple-instance templates - MediaWiki

Multiple-instance templates refer to the use of a series of instances of the same (wiki) template on a single wiki page, usually with unique data assigned to each instance. For instance, instances of a template may be used to list the contacts of a company, the ingredients of a recipe, the stories in a book, etc. In this way, you can present items of the same type in a uniform manner and streamline structured data so that they can be stored in the database.

The term is typically used in the context of managing such a list of template instances by way of a form (see the form extensions below) as well as itemising data to be stored in the database (see the data storage extensions below).

Structurally, multiple-instance templates can be either top-level templates or children of a parent template. A child template is an instance of a template assigned to a parameter of the parent template. A top-level template is not nested in this way and may or may not behave as a parent template for one or multiple child templates. Deeper levels of nesting templates are not impossible, but lack support in form extensions.

Example

The ingredients of some recipe for salad :

{{Recipe
|Title=My favourite salad
|Ingredients={{Ingredient
 |Item=Romaine lettuce
 |Quantity=Four leaves.
 |Preparation=Torn.
}}{{Ingredient
 |Item=Radish
 |Quantity=Six radishes.
 |Preparation=Chopped.
}}{{Ingredient
 |Item=Tomato
 |Quantity=2 tomatoes.
 |Preparation=Chopped.
}}{{Ingredient
 |Item=Licame
 |Quantity=A small one.
 |Preparation=Peeled and julienned.
}}
}}

(etc.)

Form extensions

A number of extensions are available that let you use a form to manage template instances more easily.

  • Extension:Page Forms: see especially this help page. The term 'multiple-instance templates' was likely coined for this extension.
  • Extension:FlexForm: offers similar support. See especially this help page.

Data storage extensions

Template instances can be used as containers for structured data. The following extensions offer parser functions that can be used in a template to store data:

  • Extension:Semantic MediaWiki (SMW) - offers the #subobject parser function for self-contained units of property-value pairs as well as a data type called Record.
  • Extension:Cargo - offers #cargo_declare and #cargo_store, which can be used in a way similar to SMW's subobjects.

See also

  • Help:Tabular data
  • Manual:Managing data in MediaWiki
  • Manual:Template limits
  • Extension:TemplateFunc
Retrieved from "https://www.mediawiki.org/w/index.php?title=Help:Multiple-instance_templates&oldid=7916655"
Category:
  • Templates
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.