Help:Plainlist format – parameter template

From semantic-mediawiki.org
Parameter template
This help page explains how to specify a template that should be used to display the output of the query.
Keywords
Table of Contents

This help page explains the usage of the template parameter 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.

Often the parameters introtemplate and outrotemplate are used together with this parameter, however this is optional.

The templates specified with these parameters get stacked when being rendered. The template specified with the introtemplate parameter is rendered above the template specified with the template parameter whereas the template specified with the outrotemplate parameter is rendered below the template specified with the template parameter which is in turn rendered as often as there are results to a query.

Templates are used when printouts require more complex handling for an output than just displaying them with result format "Table"Outputs the results in a table (default for queries with printout statements). and its more basic display options.

Example[edit]

Syntax
{{#ask:
 [[Category:City]]
 [[Located in::Germany]]
 |?Population
 |?Area
 |format=plainlist
 |introtemplate=TableUnnamedArgsHeader
 |template=TableUnnamedArgsBody
 |outrotemplate=TableFooter
}}
Result
City Population Area
Berlin 3,520,061 891.85 km²344.34 sqmi <br />
Cologne 1,080,394 405.02 km²156.38 sqmi <br />
Frankfurt 679,664 248.31 km²95.87 sqmi <br />
Munich 1,353,186 310.43 km²119.86 sqmi <br />
Stuttgart 606,588 207.35 km²80.06 sqmi <br />
Würzburg 126,635 87.63 km²33.83 sqmi <br />

The templates used to create this example: TableUnnamedArgsHeader, TableUnnamedArgsBody and TableFooter.

Note
  • The argument is added to the template like, e.g. {{{1}}} in the same ascending order as the result and the printout statements are queried.
  • To hide the argument if the result does not have a value for the respective printout statement use, e.g. {{{1|}}}.
  • To fill the argument if the result does not have a value for the respective printout statement use, e.g. {{{1|sometext}}}.

Limitations[edit]

By default the number of nested calls 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). is limited to 2. This means that the template used to display results of a query may itself execute another query which in turn cannot execute another query using 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).. See the help page on configuration parameter $maxRecursionDepthSets the recursion depth for a template output for further information on output recursion depth.

Example

Page A contains an inline query that uses template 1, which itself contains an inline query that uses template 2. Template 2 may contain yet another query, but none using 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)..

Variables[edit]

This parameter as well as the introtemplate and outrotemplate parameters allow for using variables to display the output of the query:

See also[edit]