Template:Favilink id: Difference between revisions

m
added note about f template
(Created page with "<includeonly><span class="qud-image"><span class="qud-image-link-image-container">{{#ifexist: {{#cargo_query:table=GeneralData|fields=CONCAT('File:',Image)|where=_pageNamespac...")
 
m (added note about f template)
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<includeonly><span class="qud-image"><span class="qud-image-link-image-container">{{#ifexist: {{#cargo_query:table=GeneralData|fields=CONCAT('File:',Image)|where=_pageNamespace='0' AND ObjectID='{{#replace:{{{1|}}}|'|''}}'|format=template|template=single query result|limit=1|more results text=}} | [[File:{{#cargo_query:table=GeneralData|fields=Image|where=_pageNamespace='0' AND ObjectID='{{#replace:{{{1|}}}|'|''}}'|format=template|template=single query result|limit=1|more results text=|default=}}|16px|link={{{1|}}}]] | {{#cargo_query:table=GeneralData|fields=DisplayChar|where=_pageNamespace='0' AND ObjectID='{{#replace:{{{1|}}}|'|''}}'|format=template|template=single query result|limit=1|more results text=|default=}} }}</span><span class="qud-image-link" style="color:#b1c9c3;">[[{{ID to name|{{{1|}}}}}|{{#if: {{{2|}}}|{{Qud text|&y{{{2}}}|notxml}}|{{#cargo_query:table=GeneralData|fields=DisplayName|where=_pageNamespace='0' AND ObjectID='{{#replace:{{{1|}}}|'|''}}'|limit=1|more results text=|default={{{1}}}}}}}]]</span></span></includeonly><noinclude>
<includeonly>{{#invoke:Favilink| idfavilink |{{#if:{{{Page|}}}|{{{Page}}}|{{{1|}}} }}|{{{2|}}}}}</includeonly><noinclude>
[[Category:Shorthand Templates]]
[[Category:Shorthand Templates]]
!!Currently only for use for objects in the tables: ItemsTable, Food, Corpses, Characters. All possible items can be found here: [[Special:CargoTables/GeneralData]]. This is [[Template:Favilink]], but searches by ObjectID instead of page name.
NOTE: this can also be invoked with [[Template:F id]], which is fewer characters to type. Currently only for use for objects in the tables: ItemsTable, Food, Corpses, Characters, Mutations. All possible items can be found here: [[Special:CargoTables/GeneralData]]. This is [[Template:Favilink]], but searches by ObjectID instead of page name.
 
This template is most useful if there are multiple pages that have overlapping/similar names as it's easier to distinguish which page you want to favilink to.
 
Note that when using this template for mutation pages, you must prefix the mutation's ID with <code>Mutation:</code>. That prefix is added to all mutation IDs to avoid ID collisions in the wiki's cargo database.
 
==Usage==
==Usage==
Used similar to regular wikipage linking syntax. First argument takes name of the page and will pull the image from that item.
Used similar to regular wikipage linking syntax. First argument takes name of the page and will pull the image from that item.
<syntaxhighlight lang="xml">
{{favilink id|stopsvaalinn}}
</syntaxhighlight>
{{favilink id|stopsvaalinn}}


You can also use a second argument to reword the link:
==Optional Parameters==
You can use the following values as the second argument:
{| class="wikitable"
! <code>plural</code>
| pluralizes the item name while preserving the color formatting.
 
<pre>
{{favilink id|Antimatter Cell|plural}}
</pre>
 
{{favilink id|Antimatter Cell|plural}}
 
|-
! <code>possessive</code>
| makes the item name possessive while preserving the color formatting.
 
<pre>
{{favilink id| Q Girl | possessive}}
</pre>
 
{{favilink id| Q Girl | possessive}}
 
|-
! style="white-space:nowrap;" | <code>displayname-tooltip-override</code>
| makes the hover tooltip equal to the display name for items whose display name doesn't match their page name, such as <code>cybernetics credit wedge 1¢</code>. This is probably only needed in special locations where part of the favilink can get truncated, such as in the Character infobox's Inventory list.
 
<pre>
{{favilink id|CyberneticsCreditWedge2|displayname-tooltip-override}}
</pre>
 
<div class="qud-inventory-item" style="font-family:'Open Sans';font-size:15.5px;">{{favilink id|CyberneticsCreditWedge2|displayname-tooltip-override}}</div>
 
<div style="margin:1.5em 0 0.5em 2em;color:grey;">
''Compare to tooltip when this parameter is not specified:''
<div class="qud-inventory-item" style="font-family:'Open Sans';font-size:15.5px;">{{favilink id| CyberneticsCreditWedge2}}</div>
</div>
|-
! ''<any other value>''
| completely overrides the name shown in the favilink to whatever argument specified.
 
<pre>
{{favilink id|Torch|A &Rreally&y spicy meatball}}
</pre>


<syntaxhighlight lang="xml">
{{favilink id|Torch|A &Rreally&y spicy meatball}}
{{favilink id|Cudgel8th|A &Rreally&y spicy meatball}}
|-
</syntaxhighlight>
|}


{{favilink id|Cudgel8th|A &Rreally&y spicy meatball}}
</noinclude>
</noinclude>