Difference between revisions of "Template:Q"

From RimWorld Wiki
Jump to navigation Jump to search
(Error message if invalid Page or Property is provided)
(manual undo last two changes. there is still something broken and I can't figure out what the issue is)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
<includeonly>{{#if:{{#vardefineecho:q|{{#show: {{{1}}} | ?{{{2}}} | link = none }} }}|{{{5|}}}{{#var:q}}{{{4|}}}|{{{3| <span style="color: red;">'''(Error: Page or property not found)'''</span> }}} }}</includeonly><noinclude>{{documentation}}</noinclude>
+
<includeonly>{{#vardefine:q|{{#if:1|{{#show: {{{1}}} | ?{{{2}}} | link = none }}}}}}{{#ifeq:{{#var:q}}-|-|{{{3|}}}|{{{5|}}}{{#var:q}}{{{4|}}}}}</includeonly><noinclude><!-- Add categories and interwikis to the /doc subpage, not here! -->{{documentation}}</noinclude>

Latest revision as of 13:12, 23 June 2022

Documentation icon Template documentation[view] [edit] [history] [purge]

Description

This template shows the specified property of a page. Can be used within tables or anywhere.

Syntax

{{Q|page|property|default text|suffix|prefix}}

Required parameters:
Page: The name of the page to be queried against.
Property: Show the value of this property.

Optional parameters:
Default text: Text to be displayed if the query has nothing to display. Typically this is N/A or a dash.
Suffix: Text to be displayed immediately after the query result.
Prefix: Text to be displayed immediately before the query result.

Samples

Typing:

{{Q|Gold|Beauty Offset}}

Gives:

12


Typing:

{{Q|Muffalo|Carrying Capacity|| kg|Muffalo carrying capacity: }}

Gives:

Muffalo carrying capacity: 158 kg