[edit] [purge] Template documentation
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. This template intentionally does nothing if no page name is supplied, a behavior important in certain contexts.
Compare with
{{Getfact}}- The original version of this template. which defaults to querying from the base page if no page is provided. While that is critical behavior in most cases, it is also unsafe in certain contexts, which is why this template, {{Getfactfrompage}}, exists.
{{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 any page the following wikitext would produce these results.
Wikitext Result
{{getfactfrompage|birth county|page=Abraham Hunsberger (1786-1860)}} Bucks County, Pennsylvania
{{getfactfrompage|birth locality|page=Abraham Hunsberger (1786-1860)|if blank=unknown city}} unknown city
Parameter Description
1 the property to query
page if omitted, this template performs no query and returns nothing.
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.