Tech issue:Structured wiki template tricks

213,879pages on
this wiki
Add New Page
Add New Page Talk0

There are some general tricks used widely to give a wiki some structured database capabilities. This article gives a thumbnail sketch of these techniques. Knowlege of advanced template writing is assumed. No effort is made to explain concepts such as parser functions.

Storing structured fields for later retrieval Edit

Goal: a way of storing aggregate information in distinct values that can be queried later.

The general trick is described in m:Help:Advanced_templates#Producing the value of a parameter whose name depends on the value of another parameter. If you look at the example, you will see that the tvv template is exactly the format of an info page. The main difference is the number of "foo" values is very large eg
|Surname= Lincoln
|Father = Barney Rubble (c40,000BC)
and so on. When called, the "Key" value passed in is, like "parameter" is set to the desired return parameter such as Surname or whatever.

The table layout on the info page sets hcard/microformat metadata values, but little attention has been paid to this feature so far. We likely want to store these values via parameter on the main page of each person article- perhaps as part of the Template:Showinfo person

The rest of it is just housekeeping helper functions like Template:Get

Also on Fandom

Random Wiki