Difference between revisions of "User:PanchamBro/Sandbox/Pink"

From Nookipedia, the Animal Crossing wiki
(cleaning up unused sandbox)
Tag: Replaced
Line 1: Line 1:
'''{{Colorshow|eda4eb|What's with this color?}}'''
+
{{Help}}
 +
This article deals with '''[[mw:Extension:Cargo|the Cargo extension]]''' used on '''Nookipedia''' and its [https://api.nookipedia.com/ 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 [[mw:Extension:Semantic MediaWiki|Semantic MediaWiki]], Cargo is more easier to use in comparison. Cargo tables can be found at [[Special:CargoTables]]. Cargo also provides a [[Special:Drilldown|drilldown page]] and a [[Special:CargoQuery|cargo query page]].
 +
 
 +
The major parsers to look out for when finding a page that uses the Cargo extension are <code>#cargo_declare</code>, <code>#cargo_store</code>, and <code>#cargo_query</code>.
 +
 
 +
==Creating a cargo table==
 +
To begin, you must start a <code>#cargo_declare</code> parser function. The parser '''must''' be enclosed with <code><nowiki><noinclude></nowiki></code>.
 +
 
 +
You must specify the cargo table's name, followed by field names. Both of them cannot have spaces or dashes. For instance:
 +
<pre><nowiki>
 +
<noinclude>{{#cargo_declare:
 +
_table = name_of_table
 +
|field1 = type
 +
|field2 = type
 +
...
 +
}}</noinclude></nowiki></pre>
 +
 
 +
===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 names used on Nookipedia:
 +
* <code>String</code>: Holds up to 300 characters of non-wikitext text.
 +
* <code>Text</code>: Holds non-wikitext text, intended for longer values.
 +
* <code>Integer</code>: Holds an integer or numerical value (e.g. "11").
 +
* <code>Float</code>: Holds a non-integer value (e.g. "3.14").
 +
* <code>Date</code>: Holds a date value (e.g. "10-23-2010").
 +
* <code>Boolean</code>: Holds a boolean value, consisting of two states (value can be either "0"/"1" or "yes"/"no").
 +
* <code>Wikitext string</code>: Holds up to 300 characters of text parsed by MediaWiki (e.g. {{Currency|Bells|400}}).
 +
* <code>Wikitext</code>: Holds text parsed by MediaWiki, intended for longer values.
 +
 
 +
===Storing data===

Revision as of 03:53, May 11, 2022

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, and #cargo_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. 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 names 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.

Storing data