Line 40: |
Line 40: |
| Most of this page explains the various arguments one may use in inline queries. | | Most of this page explains the various arguments one may use in inline queries. |
| | | |
− | Prior to Semantic MediaWiki 1.0 there was a different syntax for inline queries using an <tt><nowiki><ask></nowiki></tt> tag, which is still enabled on some wikis. Please see the [[Help:Inline queries 0.7|old documentation page]] for details on this feature. It is strongly recommended to use only the new syntax now. | + | Prior to Semantic MediaWiki 1.0 there was a different syntax for inline queries using an <tt><nowiki><ask></nowiki></tt> tag, which is still enabled on some wikis. Please see the [http://semantic-mediawiki.org/wiki/Help:Inline_queries_0.7 old documentation page] for details on this feature. It is strongly recommended to use only the new syntax now. |
| | | |
| == The #show parser function == | | == The #show parser function == |
Line 59: |
Line 59: |
| | | |
| # Which pages are requested? ([http://semantic-mediawiki.org/wiki/Help:Selecting_pages query description]) | | # Which pages are requested? ([http://semantic-mediawiki.org/wiki/Help:Selecting_pages query description]) |
− | # What information should be displayed about those pages? ([[Help:Displaying information|printout statements]]) | + | # What information should be displayed about those pages? ([http://semantic-mediawiki.org/wiki/Help:Displaying_information printout statements]) |
| # How should the results be formatted within the page? | | # How should the results be formatted within the page? |
| | | |
Line 97: |
Line 97: |
| | <tt>sort</tt> | | | <tt>sort</tt> |
| | property name or a list of property names separated by , | | | property name or a list of property names separated by , |
− | | name of properties to use for sorting queries (see [[Help:Selecting pages]]) | + | | name of properties to use for sorting queries (see [http://semantic-mediawiki.org/wiki/Help:Selecting_pages Selecting pages]) |
| |- | | |- |
| | <tt>order</tt> | | | <tt>order</tt> |
Line 195: |
Line 195: |
| === Sorting results === | | === Sorting results === |
| | | |
− | It has been explained in [[Help:Selecting pages]] that query results can be ordered by one or more properties. As explained there, [[Special:Ask]] has additional input fields to specify sort properties and ordering. In inline queries, sort properties are defined with the parameter <tt>sort</tt>, and the order can be set with the parameter <tt>order</tt>. The value of <tt>order</tt> should be «<tt>ascending</tt>» or «<tt>descending</tt>», or one of the short forms «asc» and «desc», or «reverse». You can also set the value to «<tt>random</tt>» (or «<tt>rand</tt>») for ordering results in an essentially random way (this feature can be disabled by the site administrator, see [[Help:Configuration|Configuration]]). An example is the following query for the three largest cities in Germany: | + | It has been explained in [http://semantic-mediawiki.org/wiki/Help:Selecting_pages selecting pages] that query results can be ordered by one or more properties. As explained there, [[Special:Ask]] has additional input fields to specify sort properties and ordering. In inline queries, sort properties are defined with the parameter <tt>sort</tt>, and the order can be set with the parameter <tt>order</tt>. The value of <tt>order</tt> should be «<tt>ascending</tt>» or «<tt>descending</tt>», or one of the short forms «asc» and «desc», or «reverse». You can also set the value to «<tt>random</tt>» (or «<tt>rand</tt>») for ordering results in an essentially random way (this feature can be disabled by the site administrator, see [http://semantic-mediawiki.org/wiki/Help:Configuration Configuration]). An example is the following query for the three largest cities in Germany: |
| | | |
| <pre>{{#ask: [[Category:City]] [[Located in::Germany]] | | <pre>{{#ask: [[Category:City]] [[Located in::Germany]] |
Line 358: |
Line 358: |
| == Using templates for custom formatting == | | == Using templates for custom formatting == |
| | | |
− | Some of the above result formats support the use of wiki [[meta:Help:Template|template]] to fully control the display of an inline query. This works for the formats <tt>template</tt>, <tt>list</tt>, <tt>ol</tt> and <tt>ul</tt>. If a template is specified, all result «rows» are formatted using this template. The name of the template (without the initial «Template:») is given in the parameter <tt>template</tt>, so the query has the following general form: | + | Some of the above result formats support the use of wiki [http://semantic-mediawiki.org/wiki/meta:Help:Template template] to fully control the display of an inline query. This works for the formats <tt>template</tt>, <tt>list</tt>, <tt>ol</tt> and <tt>ul</tt>. If a template is specified, all result «rows» are formatted using this template. The name of the template (without the initial «Template:») is given in the parameter <tt>template</tt>, so the query has the following general form: |
| | | |
| <nowiki>{{#ask:</nowiki> ... | format=template/list/ol/ul | template=''templatename'' }} | | <nowiki>{{#ask:</nowiki> ... | format=template/list/ol/ul | template=''templatename'' }} |