Difference between revisions of "Parser Function semorg-list"

From SemanticOrganization
Jump to: navigation, search
(Created page with "This parser function is used to show lists of pages belonging to a certain category. {| class="table table-bordered table-condensed" ! Markup !! Result |- |<code><nowiki>{{#...")
 
Line 37: Line 37:
 
=== {{semorg-parser-function-parameter|?<field-name>}} ===
 
=== {{semorg-parser-function-parameter|?<field-name>}} ===
  
By default, the parser function queries all fields that are defined for the feature and passes them on to the row template as [Help:Template_format#Usage_for_template_arguments.3D.5Bnamed.7Clegacy.5D_.28named_args.29 named args]. You can add custom lines to query for your custom fields or for chained properties. For example, if you would like to use the city of the group's host in the row template you could add <code><nowiki>|?semorg-group-host.semorg-person-email=email</nowiki></code>.
+
By default, the parser function queries all fields that are defined for the feature and passes them on to the row template as [https://www.semantic-mediawiki.org/wiki/Help:Template_format#Usage_for_template_arguments.3D.5Bnamed.7Clegacy.5D_.28named_args.29 named args]. You can add custom lines to query for your custom fields or for chained properties. For example, if you would like to use the city of the group's host in the row template you could add <code><nowiki>|?semorg-group-host.semorg-person-email=email</nowiki></code>.
  
 
In order for this to work, you will need to use the <code>row template</code> parameter to call your custom template, where you can then use <code><nowiki>{{{?email|}}}</nowiki></code> to get the value. You can customize the headers if you also create a <code><nowiki>semorg-list-<row template>-headers</nowiki></code> system message. If a message of that name doesn't exist, the default <code><nowiki>semorg-list-<feature>-headers</nowiki></code> message will be used.
 
In order for this to work, you will need to use the <code>row template</code> parameter to call your custom template, where you can then use <code><nowiki>{{{?email|}}}</nowiki></code> to get the value. You can customize the headers if you also create a <code><nowiki>semorg-list-<row template>-headers</nowiki></code> system message. If a message of that name doesn't exist, the default <code><nowiki>semorg-list-<feature>-headers</nowiki></code> message will be used.

Revision as of 20:19, 3 May 2019

This parser function is used to show lists of pages belonging to a certain category.

Markup Result
{{#semorg-list:group}}

Messages

The following system messages control the appearance of the list:

Message Function
semorg-list-<feature>-headers Should contain a list of message keys that contain the texts for the table headers. For the example above the content of semorg-list-group-headers is “group-name, group-description, group-host, group-members“. The elements of the list should have the general form of <feature>-<field>. The list is used to reference another set of messages following the naming convention semorg-field-<feature>-<field>-name. So semorg-field-group-name-name is used to populate the heading of the first column in the example above.

Parameters

The following parameters are available:

category

The default category is the content of semorg-<feature>-category. If you want to use a different category, you can overwrite the default using this parameter.

row template

The parser function constructs a query that calls a template for every row. The default value is the same as the name of the feature. The actual name of the template called should be semorg-<row template>-row. You'll have to provide it on your own if you want to replace the default.

query

You can add additional query conditions using Semantic MediaWiki's syntax. For example, if you would like to list only active groups, just add query=[[semorg-group-active::true]].

?<field-name>

By default, the parser function queries all fields that are defined for the feature and passes them on to the row template as named args. You can add custom lines to query for your custom fields or for chained properties. For example, if you would like to use the city of the group's host in the row template you could add |?semorg-group-host.semorg-person-email=email.

In order for this to work, you will need to use the row template parameter to call your custom template, where you can then use {{{?email|}}} to get the value. You can customize the headers if you also create a semorg-list-<row template>-headers system message. If a message of that name doesn't exist, the default semorg-list-<feature>-headers message will be used.

sort, order, default, limit

These are the same as the standard parameters of {{#ask}} queries.