Template:Getfact
From Historical Hastings
- Purpose
- For template writers, this is a convenient wrapper template that will fetch a single property, setting various #show options automatically, and optionalling returning a default string if the results are null, or the illegal value of 9999. No formatting is performed.
- Compare with
- {{Showfact}}- An alternative template intended for formatting information for the reader. This will optionally do formatting and perform various tranformations such as translation into the vernacular by default. By contrast, GetFact simply returns the value in the database and may be used for subsequent comparisons and other template processing.
- Usage examples
- On page Vandeleur Benjamin Crake (1816-1894) the following wikitext would produce these results.
Wikitext Result {{getfact|given name|if blank=unknown}} Vandeleur
| Parameter | Description |
|---|---|
| 1 | the property to query |
| page | if omitted, results are returned for the current page. Otherwise the query is performed on the page specified. |
| if blank | if the query does not return anything, then the text with the "if blank" parameter is returned instead. |
| link | If omitted, a plain string value is returned. If set to "all", then values that a pages are returned as links. Values: none, all. Default=none. For further info see link details in the SMW documentation for inline queries. |
- Performance note
- Semantic MediaWiki exploits the caching mechanism of mediawiki software. Since the article is in memory, queries on its properties have virtually no cost, so a page may use large numbers of these queries without making the page slower.
| The above documentation is transcluded from Template:Getfact/doc. (edit | history) Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages. Please add categories to the /doc subpage. Subpages of this template. |