User:PanchamBro/Sandbox/Pink

From Nookipedia, the Animal Crossing wiki

This article deals with the Cargo extension used on Nookipedia and its API. It teaches you how to properly create and query a cargo table.

What is Cargo?

Cargo is a MediaWiki extension that allows the storage and query of data within templates using cargo tables. Although similar in functionality to Semantic MediaWiki, Cargo is more easier to use in comparison. Cargo tables can be found at Special:CargoTables. Cargo also provides a drilldown page and a cargo query page.

The major parsers to look out for when finding a page that uses the Cargo extension are #cargo_declare, #cargo_store, #cargo_query, #cargo_attach, and #cargo_compound_query.

Creating a cargo table

To begin, you must start a #cargo_declare parser function. The parser must be enclosed with <noinclude>.

You must specify the cargo table's name, followed by field names associated with a type. Both of them cannot have spaces or dashes. For instance:

<noinclude>{{#cargo_declare:
_table = name_of_table
|field1 = type
|field2 = type
...
}}</noinclude>

Field types

When adding a field name, it's important to specify the type of field that the field can store. The following are common field types used on Nookipedia:

  • String: Holds up to 300 characters of non-wikitext text.
  • Text: Holds non-wikitext text, intended for longer values.
  • Integer: Holds an integer or numerical value (e.g. "11").
  • Float: Holds a non-integer value (e.g. "3.14").
  • Date: Holds a date value (e.g. "10-23-2010").
  • Boolean: Holds a boolean value, consisting of two states (value can be either "0"/"1" or "yes"/"no").
  • Wikitext string: Holds up to 300 characters of text parsed by MediaWiki (e.g.  400 Bells).
  • Wikitext: Holds text parsed by MediaWiki, intended for longer values.

You can also associate a list of a type to a field. For instance, List (,) of String will provide a list of String values.

Storing data