Template:SMW table

This is the current revision of this page, as edited by Alex (talk | contribs) at 00:47, 17 October 2024 (Created page with "<includeonly>{{#invoke:SMW table|main}}</includeonly><noinclude>{{/doc}}</noinclude>"). The present address (URL) is a permanent link to this version.

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Template documentation
This documentation is transcluded from Template:SMW table/doc. [edit] [history] [purge]
Template:SMW table invokes function main in Module:SMW table using Lua.

This template can be used to generate a table based on a Semantic MediaWiki query, able to show any number of SMW properties in its columns.

Parameters

The following table shows the available parameters, with X representing the index of the column/property that is being customised. For the parameters that specify a version without X, the default can be defined by setting the parameter without a number (e.g. |data=number to set the default column datatype to numbers)

Parameter Default Use
colX N/A To specify the property to search for. This value will also be passed as the second %s in the headerX format.
imgX File:Unknown NPC.png To specify the image that should be placed at the top of the table. This value will be passed as the first %s in the headerX format.
limit 100 Set the maximum amount of results that are shown in a single table.
header, headerX [[File:%s|link=|%s]] Provides the format for the table header. The first %s in this string will be substituted by the value of img in that column, and the second %s will be substituted by the value of col for that column.
data, dataX number The format given in the specified column. This value determines the sort order for that column. Set to string if the column contains text instead of numbers.
sep, sepX , The separator used to join properties that contain multiple values. If one value is associated with the given property this parameter is not used.
class N/A Additional classes to assign to the table. Classes that will always be assigned are wikitable sortable sticky-header.

A col0 may also be specified to insert a row to the left of the article name, which may be useful for inserting images. If such a col is specified, the data0 parameter can be used to specify if the column should be shown as an image (default), link or text.

Example

{{SMW table|class=mw-collapsible mw-collapsed
|[[Is variant of::<q>[[Category:Undead]]</q>]][[Is variant of::<q>[[Category:Monsters]]</q>]] OR 
[[Combat level::+]][[Category:Undead]][[Category:Monsters]]
|data=number
|col0=Image
|col1=Is members only|img1=Member icon.png
|col2=Attack level|img2=Attack icon.png
|col3=Strength level|img3=Strength icon.png
|col4=Defence level|img4=Defence icon.png
|col5=Ranged level|img5=Ranged icon.png
|col6=Magic level|img6=Magic icon.png
|col7=Hitpoints|img7=Hitpoints icon.png
|col8=Combat level|img8=Attack style icon.png
|col9=NPC ID|header9=NPC ID|sep8= / 
}}

This query will look for any submodules of pages with the given categories, OR pages in these categories that have a specified combat level (implying that there is no switch infobox)

Lua error in Module:SMW_table at line 137: No pages were found matching your query.