<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://mwiki.costasano.club/index.php?action=history&amp;feed=atom&amp;title=ICT%3ADocumentation%3ACargo_in_Template_Asset</id>
	<title>ICT:Documentation:Cargo in Template Asset - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://mwiki.costasano.club/index.php?action=history&amp;feed=atom&amp;title=ICT%3ADocumentation%3ACargo_in_Template_Asset"/>
	<link rel="alternate" type="text/html" href="https://mwiki.costasano.club/index.php?title=ICT:Documentation:Cargo_in_Template_Asset&amp;action=history"/>
	<updated>2026-07-23T00:13:12Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://mwiki.costasano.club/index.php?title=ICT:Documentation:Cargo_in_Template_Asset&amp;diff=1215&amp;oldid=prev</id>
		<title>Mngr: Created page with &quot;= Explanation of Cargo Usage in Template:Asset =  This page documents how and why Cargo is used in &#039;&#039;&#039;Template:Asset&#039;&#039;&#039;.  It exists as long-term reference documentation and is intended to be read slowly and re-read over time.  ----  == Purpose of This Document ==  Cargo configuration is often difficult to understand because:  * it mixes schema definition and data storage * it uses parser functions that look similar but behave very differently * errors are often silent  T...&quot;</title>
		<link rel="alternate" type="text/html" href="https://mwiki.costasano.club/index.php?title=ICT:Documentation:Cargo_in_Template_Asset&amp;diff=1215&amp;oldid=prev"/>
		<updated>2026-02-20T13:13:31Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;= Explanation of Cargo Usage in Template:Asset =  This page documents how and why Cargo is used in &amp;#039;&amp;#039;&amp;#039;Template:Asset&amp;#039;&amp;#039;&amp;#039;.  It exists as long-term reference documentation and is intended to be read slowly and re-read over time.  ----  == Purpose of This Document ==  Cargo configuration is often difficult to understand because:  * it mixes schema definition and data storage * it uses parser functions that look similar but behave very differently * errors are often silent  T...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Explanation of Cargo Usage in Template:Asset =&lt;br /&gt;
&lt;br /&gt;
This page documents how and why Cargo is used in &amp;#039;&amp;#039;&amp;#039;Template:Asset&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
It exists as long-term reference documentation and is intended to be read&lt;br /&gt;
slowly and re-read over time.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Purpose of This Document ==&lt;br /&gt;
&lt;br /&gt;
Cargo configuration is often difficult to understand because:&lt;br /&gt;
&lt;br /&gt;
* it mixes schema definition and data storage&lt;br /&gt;
* it uses parser functions that look similar but behave very differently&lt;br /&gt;
* errors are often silent&lt;br /&gt;
&lt;br /&gt;
This document explains, line by line, the Cargo-related parts of Template:Asset,&lt;br /&gt;
without involving Page Forms, JavaScript, or Lua.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Big Picture ==&lt;br /&gt;
&lt;br /&gt;
Cargo is used in Template:Asset for exactly two purposes:&lt;br /&gt;
&lt;br /&gt;
# &amp;#039;&amp;#039;&amp;#039;Declare the data structure&amp;#039;&amp;#039;&amp;#039; (schema)&lt;br /&gt;
# &amp;#039;&amp;#039;&amp;#039;Store data when a page is saved&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Cargo does NOT:&lt;br /&gt;
* control page layout&lt;br /&gt;
* control page editing&lt;br /&gt;
* control file uploads&lt;br /&gt;
* control automation&lt;br /&gt;
&lt;br /&gt;
Cargo only stores and retrieves structured data.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Cargo Declaration Section ==&lt;br /&gt;
&lt;br /&gt;
In Template:Asset, the Cargo declaration appears inside a &amp;lt;code&amp;gt;&amp;amp;lt;noinclude&amp;amp;gt;&amp;lt;/code&amp;gt; section:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;noinclude&amp;gt;&lt;br /&gt;
{{#cargo_declare:&lt;br /&gt;
 |_table=Assets&lt;br /&gt;
 |Code=Page&lt;br /&gt;
 |Label=String&lt;br /&gt;
 |Chapter=Page&lt;br /&gt;
 |Place=Page&lt;br /&gt;
 |Organisation=Page&lt;br /&gt;
 |Sequence=Integer&lt;br /&gt;
 |File=String&lt;br /&gt;
 |OriginalFilename=String&lt;br /&gt;
 |Parent=Page&lt;br /&gt;
 |AssetType=Page&lt;br /&gt;
 |Description=Text&lt;br /&gt;
 |Notes=Text&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This section defines the structure of the Cargo table.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Why cargo_declare Is Inside &amp;amp;lt;noinclude&amp;amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;amp;lt;noinclude&amp;amp;gt;&amp;lt;/code&amp;gt; means:&lt;br /&gt;
&lt;br /&gt;
* The declaration is part of the template definition&lt;br /&gt;
* It is NOT included when the template is transcluded into a page&lt;br /&gt;
&lt;br /&gt;
Why this matters:&lt;br /&gt;
&lt;br /&gt;
* The Cargo table is declared once&lt;br /&gt;
* It is not redeclared every time an Asset page is viewed&lt;br /&gt;
* Prevents schema duplication and errors&lt;br /&gt;
&lt;br /&gt;
Important rule:&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;cargo_declare MUST always be inside &amp;amp;lt;noinclude&amp;amp;gt;.&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== The Cargo Table Name ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
|_table=Assets&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
What it does:&lt;br /&gt;
* Defines the name of the Cargo table&lt;br /&gt;
* All Asset records are stored in this table&lt;br /&gt;
&lt;br /&gt;
Why it matters:&lt;br /&gt;
* Table name is global and permanent&lt;br /&gt;
* Changing it later breaks all queries&lt;br /&gt;
&lt;br /&gt;
In Asset v2, the table name &amp;#039;&amp;#039;&amp;#039;Assets&amp;#039;&amp;#039;&amp;#039; is locked.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Field Definitions ==&lt;br /&gt;
&lt;br /&gt;
Each line defines one field (column) in the table.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
|Label=String&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Meaning:&lt;br /&gt;
* Field name: &amp;lt;code&amp;gt;Label&amp;lt;/code&amp;gt;&lt;br /&gt;
* Field type: &amp;lt;code&amp;gt;String&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Cargo types define how data is stored and queried.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Explanation of Field Types Used ==&lt;br /&gt;
&lt;br /&gt;
=== Page ===&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
|Chapter=Page&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
What it means:&lt;br /&gt;
* Stores a wiki page reference&lt;br /&gt;
* Enables linking and page-based queries&lt;br /&gt;
&lt;br /&gt;
Used for:&lt;br /&gt;
* Chapter&lt;br /&gt;
* Place&lt;br /&gt;
* Organisation&lt;br /&gt;
* Parent&lt;br /&gt;
* AssetType&lt;br /&gt;
* Code (page name)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== String ===&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
|OriginalFilename=String&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
What it means:&lt;br /&gt;
* Stores plain text&lt;br /&gt;
* No page linkage&lt;br /&gt;
* No namespace assumptions&lt;br /&gt;
&lt;br /&gt;
Used for:&lt;br /&gt;
* Original filenames&lt;br /&gt;
* File names&lt;br /&gt;
* Labels&lt;br /&gt;
&lt;br /&gt;
Important:&lt;br /&gt;
File is stored as String on purpose to avoid Page-type constraints.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Integer ===&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
|Sequence=Integer&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
What it means:&lt;br /&gt;
* Stores numeric values&lt;br /&gt;
* Enables numeric comparison and MAX() queries&lt;br /&gt;
&lt;br /&gt;
Used for:&lt;br /&gt;
* Sequence numbering&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Text ===&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
|Description=Text&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
What it means:&lt;br /&gt;
* Stores long free-form text&lt;br /&gt;
* No length limit&lt;br /&gt;
&lt;br /&gt;
Used for:&lt;br /&gt;
* Descriptions&lt;br /&gt;
* Notes&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Cargo Store Section ==&lt;br /&gt;
&lt;br /&gt;
Below the declaration, Template:Asset contains:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{{#cargo_store:&lt;br /&gt;
 |Code={{FULLPAGENAME}}&lt;br /&gt;
 |Label={{{Label|}}}&lt;br /&gt;
 |Chapter={{{Chapter|}}}&lt;br /&gt;
 |Place={{{Place|}}}&lt;br /&gt;
 |Organisation={{{Organisation|}}}&lt;br /&gt;
 |Sequence={{{Sequence|}}}&lt;br /&gt;
 |File={{{File|}}}&lt;br /&gt;
 |OriginalFilename={{{OriginalFilename|}}}&lt;br /&gt;
 |Parent={{{Parent|}}}&lt;br /&gt;
 |AssetType={{{AssetType|}}}&lt;br /&gt;
 |Description={{{Description|}}}&lt;br /&gt;
 |Notes={{{Notes|}}}&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This section is executed every time an Asset page is saved.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== What cargo_store Does ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;#cargo_store&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
* Takes values from template parameters&lt;br /&gt;
* Writes them into the Cargo table&lt;br /&gt;
* Updates existing rows automatically&lt;br /&gt;
&lt;br /&gt;
Important:&lt;br /&gt;
* It does NOT create pages&lt;br /&gt;
* It does NOT validate input&lt;br /&gt;
* It does NOT control editing&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Why Code Uses FULLPAGENAME ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
|Code={{FULLPAGENAME}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Meaning:&lt;br /&gt;
* Stores the page name of the Asset&lt;br /&gt;
* Example:&lt;br /&gt;
  &amp;lt;code&amp;gt;Asset:CH03-BER-0007&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Why this matters:&lt;br /&gt;
* The page name is the authoritative identifier&lt;br /&gt;
* Cargo rows can always be linked back to their page&lt;br /&gt;
&lt;br /&gt;
This field must never change after creation.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Why Template Parameters Use Triple Braces ==&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
|Label={{{Label|}}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Meaning:&lt;br /&gt;
* Reads the value passed to the template&lt;br /&gt;
* Uses empty default if not provided&lt;br /&gt;
&lt;br /&gt;
Triple braces are standard MediaWiki template syntax and are required.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Important Reminder ==&lt;br /&gt;
&lt;br /&gt;
Cargo does NOT enforce immutability.&lt;br /&gt;
&lt;br /&gt;
Rules such as:&lt;br /&gt;
* “Identifier must not change”&lt;br /&gt;
* “OriginalFilename is immutable”&lt;br /&gt;
&lt;br /&gt;
are enforced by:&lt;br /&gt;
* Page Forms configuration&lt;br /&gt;
* JavaScript&lt;br /&gt;
* user discipline&lt;br /&gt;
* server-side extensions&lt;br /&gt;
&lt;br /&gt;
Cargo only stores what it is given.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Mental Model to Keep ==&lt;br /&gt;
&lt;br /&gt;
You can safely remember:&lt;br /&gt;
&lt;br /&gt;
* cargo_declare = table definition&lt;br /&gt;
* cargo_store = data write operation&lt;br /&gt;
* Template parameters = data source&lt;br /&gt;
* Cargo does not control behavior&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
&lt;br /&gt;
This document is stable reference documentation.&lt;br /&gt;
&lt;br /&gt;
It exists to support long-term understanding and memory retention.&lt;/div&gt;</summary>
		<author><name>Mngr</name></author>
	</entry>
</feed>