Familypedia
Advertisement
[edit] [purge] Template documentation
Purpose
For template writers, this is a convenient wrapper template that will fetch a single property, setting various #show options automatically, and optionally returning a default string if the results are null, or the illegal value of 9999. No formatting is performed.
Compare with
{{Getfactfrompage}}- A version of {{Getfact}} that does nothing if a page is not supplied. In certain contexts, falling back to querying the base page is not desirable behavior.
{{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 Abraham Hunsberger (1786-1860) the following wikitext would produce these results.
Wikitext Result
{{getfact|birth county}} Bucks County, Pennsylvania
{{getfact|birth locality|if blank=unknown city}} unknown city
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.
Advertisement