Difference between revisions of "Template:Infobox item"

From Tycoon Gaming
m (+ description data source)
m (testing template category logic)
Line 17: Line 17:
 
         <data source="exportlocation"><label>Export at</label></data>
 
         <data source="exportlocation"><label>Export at</label></data>
 
         <data source="requires"><label>Requirements</label></data>
 
         <data source="requires"><label>Requirements</label></data>
</infobox><includeonly>[[Category:Items]]</includeonly><noinclude>{{Documentation}}</noinclude>
+
</infobox>
 +
<includeonly>
 +
{{#switch: {{NAMESPACE}}
 +
    | Main
 +
    | <!-- Check if ":" is in the third position -->
 +
        {{#ifexpr: {{#pos:{{PAGENAME}}|:|3}} = 3
 +
            | <!-- If ":" is in the third position, it's a language page -->
 +
                [[Category:{{#replace: {{PAGENAME}} | : | :Items}}]]
 +
            | <!-- If ":" is not in the third position, it's an English page -->
 +
                [[Category:Items]]
 +
        }}
 +
    | <!-- Check if ":" is in the third position -->
 +
        {{#ifexpr: {{#pos:{{PAGENAME}}|:|3}} = 3
 +
            | <!-- If ":" is in the third position, it's a language page -->
 +
                [[Category:{{#titleparts:{{PAGENAME}}|1|2}}:Items]]
 +
            | <!-- If ":" is not in the third position, it's an English page -->
 +
                [[Category:Items]]
 +
        }}
 +
}}
 +
</includeonly>
 +
<noinclude>{{Documentation}}</noinclude>

Revision as of 15:54, 4 May 2024


Description

To use this template, copy the following code and fill in the appropriate fields.

Syntax

{{infobox item
 | title         = 
 | image         = [e.g. "Example.jpg"]
 | imagecaption  = 
 | type          = 
 | effects       = 
 | source        = 
 | buy           = 
 | sell          = 
}}

Samples

Expression error: Unrecognized punctuation character "{".

{{infobox item
 | title         = Power Flower
 | image         = Example.jpg
 | type          = Food
 | effects       = +1 Fire
 | source        = Vendor
 | buy           = 5g
 | sell          = 1g
}}