Help:Plainlist format – variable #userparam

From semantic-mediawiki.org
Variable #userparam
This help page explains how to add a user defined variable to a template.
Keywords

This help page explains the usage of the #userparam variable when using templates with result format "Plainlist"Outputs results in a comma separated list, with additional outputs shown in parentheses. The output does not provide class attributes to HTML elements (default for queries without printout statements). to display the output of your queries. It was introduced with Semantic MediaWiki 1.1.2Released on 14 June 2008 and compatible with MW 1.10.x - 1.13.x..1

Since Semantic MediaWiki 1.9.2Released on 18 April 2014 and compatible with MW 1.19.0 - 1.22.x., this parameter does not just apply to the template parameter but also to the introtemplate parmeter and the outrotemplate parameter.2

The value to be added to the template as the #userparam variable is added to the query by specifying it using the userparam parameter with userparam=<value>. Note the difference between the parameter and the variable.

Example[edit]

Syntax
{{#ask:
 [[Category:City]]
 [[Located in::Germany]]
 [[Area::+]]
 [[Population::+]] 
 |?Population
 |?Area
 |format=plainlist
 |template=TableUserparam
 |userparam=have their home on a total of
}}
Result
  • Berlin − 3,520,061 people have their home on a total of 891.85 km²344.34 sqmi <br />.
  • Cologne − 1,080,394 people have their home on a total of 405.02 km²156.38 sqmi <br />.
  • Frankfurt − 679,664 people have their home on a total of 248.31 km²95.87 sqmi <br />.
  • Munich − 1,353,186 people have their home on a total of 310.43 km²119.86 sqmi <br />.
  • Stuttgart − 606,588 people have their home on a total of 207.35 km²80.06 sqmi <br />.
  • Würzburg − 126,635 people have their home on a total of 87.63 km²33.83 sqmi <br />.

The template used to create this example: TableUserparam.

Note
  • A value specified by the variable, e.g. {{{#userparam|sometext}}}, is being overridden by the value specified with userparam=<value>.

See also[edit]

References

  1. ^  Semantic MediaWiki: Phabricator task mw:phab:T16440
  2. ^  Semantic MediaWiki: GitHub pull request gh:smw:217