Extension:Cargo/Display formats

The "format=" parameter lets you set in which format to display the results.

If no format is specified, list is the default format if there is only a single field being displayed in the results, while table is the default format if there is more than one field.

The Cargo extension supports the following formats:

list
Displays results in a delimited list.

Parameters:
 * delimiter - sets the separator character (default is comma)

ul
Displays results in a bulleted list.

Parameters:
 * columns - sets the number of columns (default is 1)

Example: Discourse DB latest items

ol
Displays results in a numbered list.

Parameters:
 * columns - sets the number of columns (default is 1)

category
Displays results in the style of MediaWiki categories.

Parameters:
 * columns - sets the number of columns (default is 3)

template
Displays results using a MediaWiki template that formats each row of results. By default, the template in question should use unnamed parameters, i.e. it should refer to its parameters as, etc.

Parameters:
 * template - specifies the name of the template to use (mandatory)
 * named args - if set to "yes", specifies that the template should instead have named parameters, where the parameter names are the names (or aliases, if they are set) of the query fields

Example: Discourse DB "position" page (queries here, template here)

embedded
Shows the full text of each queried page (only the first field of the query is used). (No parameters.)

outline
Shows results in an outline format.

Parameters:
 * outline fields</tt> - holds a comma-separated list of the query's fields; these fields are used to define the outline, by which the results are grouped together (mandatory)

Example: Discourse DB opinion items outline

tree
Shows results in a tree format, in which a single field defines all the relationships between "child" pages and "parent" pages.

Parameters:
 * parent field</tt> - holds the name of this connector field (mandatory)

table
Displays results in a table. (No parameters.)

dynamic table
Displays results in a "dynamic" table that includes sorting, pagination and searching, using the DataTables JavaScript library. (No parameters.)

Examples: Discourse DB opinion items, HUES list of technology entries

tag cloud
Shows results in a "tag cloud" format, where the number corresponding to each string value dictates the font size for that string.

Parameters:
 * min size</tt> - the percentage of normal font size that the smallest text displays will have (default is 80)
 * max size</tt> - the percentage of normal font size that the largest text displays will have (default is 200)
 * template</tt> - specifies the name of a template to use to display each result

Example: MWstake tags

gallery
Displays a gallery of images, in the style of the MediaWiki &lt;gallery&gt; tag. The images must be files that were uploaded to the wiki; they can either be the pages that are directly queried (if the image pages call a Cargo-based template), or fields, of type "File", of other pages.

Parameters:
 * mode</tt> - sets the display mode of the gallery; can be traditional</tt> (the default), nolines</tt>, packed</tt>, packed-overlay</tt> or packed-hover</tt>. See here for a demonstration of these options.
 * show bytes</tt> - if set to "0", hides the size of each image (it is shown by default)
 * show filename</tt> - if set to "0", hides the name of each image (it is shown by default)
 * per row</tt> - specifies the number of images displayed on each row
 * image width</tt> - specifies the width, in pixels, at which to display each image
 * image height</tt> - specifies the height, in pixels, at which to display each image
 * <tt>caption field</tt> - specifies the name of a query field whose value should be used for each image caption
 * <tt>alt field</tt> - specifies the name of a query field whose value should be used as the "alt text" for each image
 * <tt>link field</tt> - specifies the name of a query field whose value should be used as the name of the page that the image links to

calendar
Displays results in a calendar, using the FullCalendar JavaScript library.

Parameters:
 * <tt>width</tt> - sets the width of the calendar (default is 100%)
 * <tt>start date</tt> - sets the date at which to display the calendar (default is the current date)
 * <tt>view</tt> - sets the starting display of the calendar - options are 'day', 'week', or 'month' (default is month)
 * <tt>color</tt> - sets the color in which to show the names of events; useful within #compound_query (default is set by the FullCalendar library)
 * Additionally, a field within the query with the name or alias "name" will set the name of each event to the value of that field for that event.

Example: Discourse DB opinion calendar

timeline
Displays results in a timeline, using the SIMILE Timeline library.

Parameters:
 * <tt>height</tt> - sets the height of the timeline (default is 350px)
 * <tt>width</tt> - sets the width of the timeline (default is 100%)

Examples: Discourse DB topic (see bottom of page), MHLO events timeline

bar chart
Displays results in a bar chart (with horizontal bars), using the NVD3 JavaScript library.

Parameters:
 * <tt>height</tt> - sets the height of the bar chart (default is based on the number of bars)
 * <tt>width</tt> - sets the width of the bar chart (default is 100%)

Examples: Discourse DB most popular authors, HUES technology database contents analysis (see bottom of page)

googlemaps
Displays results in a map, using the Google Maps service.

Parameters:
 * <tt>height</tt> - sets the height of the map (default is 400px)
 * <tt>width</tt> - sets the width of the map (default is 700px)
 * <tt>icon</tt> - sets a custom icon to be used to display points; value must be the name of a file that has been uploaded to the wiki. This is especially useful within #compound_query.
 * <tt>zoom</tt> - sets the zoom level, i.e. an integer value from around 0 to around 20, with higher numbers being more zoomed in (default is based on the area of the set of points being displayed).

Example: Discourse DB map test

openlayers
Displays results in a map, using the OpenLayers service.

Parameters: same as for <tt>googlemaps</tt>.

Example: Discourse DB map test (see bottom of page)

exhibit
Displays results in a browsable interface, using the SIMILE Exhibit library/service.

Parameters:
 * <tt>view</tt> - sets the view(s) that will be displayed, separated by comma if more than one. Valid values are <tt>map</tt>, <tt>tabular</tt> and <tt>timeline</tt>. If not set, the view(s) will be set based on the types of the fields in the query.
 * <tt>facets</tt> - sets the fields to be used for the facets/filters, separated by comma if more than one. A maximum of three are allowed. If not set, the first three fields of the result are used.
 * <tt>datalabel</tt> - sets the label that refers to the data. Default is "Item".`


 * for the "timeline" view:


 * <tt>end</tt> - sets the name of the field holding the end time for each event (if any)
 * <tt>color</tt> - sets the name of the field used to color-code the markers (if any)
 * <tt>topunit</tt> - sets the unit for the top band: <tt>millisecond</tt>, <tt>second</tt>, <tt>minute</tt>, <tt>hour</tt>, <tt>day</tt>, <tt>week</tt>, <tt>month</tt>, <tt>year</tt>, <tt>decade</tt>, <tt>century</tt>, <tt>millennium</tt>
 * <tt>toppx</tt> - sets the width, in pixels, for each interval in the top band
 * <tt>bottompx</tt> - sets the width, in pixels, for each interval in the bottom band

Export
Three export-based display formats are defined: <tt>csv</tt>, <tt>json</tt> and <tt>excel</tt>. See Exporting data for documentation on these. In addition, the "exhibit" format displays an orange toolbox that lets you download the current data in various export formats: BibTex, RDF/XML, JSON, Semantic Wikitext and TSV.

Additionally, the <tt>native</tt> format allows for "export" of the data for usage by other MediaWiki software, such as the Scribunto extension. When called, this format sets the global variable $wgCargoQueryResults, which holds the array. See Cargo and Lua for how to make use of Cargo query data in a Lua module.