Example on how to use the #set "template" parameter

From semantic-mediawiki.org
Jump to: navigation, search
[[Has name::"template" parameter to #set]]
{{#set:|Has description=This page describes the "template" parameter to the "#set" parser function.|template=LinkToValue}}
Keywords
{{#set:Has keyword=#set; setting values; template parameter; example; named arguments; named args; template format |+sep=;|template=LinkToAskQueryForParameter}}
Table of Contents

Starting with Semantic MediaWiki 2.2.0 the #set parser function supports a template parameter |template= with which it is possible to add #ask queries (or similar context information) to an individual silent annotation.

Example

{{#set:
 |Has keyword=Set;Template usage;#set
 |+sep=;
 |template=SetToUseTemplateForAskQuery
}}

The SetToUseTemplateForAskQuery template is used to auto-generate query links for the annotated property/value pairs.

{{#ifexpr: {{{#}}} > 0 |  ·  }}{{#ask:
 [[{{{property}}}::{{{value}}}]]
 |limit=0
 |searchlabel={{{value}}}
}}
Result

{{#set:

|Has keyword=Set;Template usage;#set
|+sep=;
|template=SetToUseTemplateForAskQuery

}}

Note: Click on the links (=query links) to access the generated query.

Documentation

See this help page for more examples on who to use the template parameter with the #set parser function.