Template:Link: Difference between revisions

From Heroes of Might and Magic: Olden Era Official Wiki
mNo edit summary
N (talk | contribs)
No edit summary
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<noinclude>
<includeonly><!--
-->{{LinkIcon
|id={{{id|}}}
|lang={{{lang|}}}
|text={{{text|}}}
|link={{{link|}}}
|filename=0
|type={{{type|}}}
|color={{{color|}}}
|wrap={{{wrap|}}}
}}<!--
####################################################################
--></includeonly><noinclude>
This template is meant to handle the linking of articles in a way that is language-agnostic, meaning that it can be used in language-aware infoboxes and other contexts which need to be able to handle multiple languages.  This template only works with concepts which have their translation managed by Cargo.
This template is meant to handle the linking of articles in a way that is language-agnostic, meaning that it can be used in language-aware infoboxes and other contexts which need to be able to handle multiple languages.  This template only works with concepts which have their translation managed by Cargo.


If '''nolink''' is provided, it will render with no link. If '''link''' is provided, it will override the lookup (normally linking to the English article, optionally with the specific-language subarticle).  
{{Note_box | This template is just a wrapper for <code><nowiki>{{LinkIcon | filename=0 | ...}}</nowiki></code>. For more examples, see [[Template:LinkIcon]].}}


{{Color|yellow|Input:}} <code><nowiki>{{Link | id=human | type=faction}}</nowiki></code>


<pre><nowiki>{{Link|type=faction|id=human}}</nowiki></pre>
{{Color|lime|Output:}} {{Link | id=human | type=faction}}


{{Link|type=faction|id=human}}
</noinclude>
 
<pre><nowiki>{{Link|type=ui|id=starting_army|nolink}}</nowiki></pre>
 
{{Link|type=ui|id=starting_army|nolink}}
 
<pre><nowiki>{{Link|type=faction|id=human|lang=pl}}</nowiki></pre>
 
{{Link|type=faction|id=human|lang=pl}}
 
 
<pre><nowiki>{{Link|type=ui|id=stats|link=Hero Basics#Attributes}}</nowiki></pre>
 
{{Link|type=ui|id=stats|link=Hero Basics#Stats}}
 
</noinclude><includeonly>{{#cargo_query:
tables  = Translation=T_en, Translation=T_disp
|join on = T_en.target_id = T_disp.target_id
|where  = (T_en.target_id  = '{{{id}}}' OR T_en.subtype = '{{{id}}}')
          AND T_en.type    = '{{{type}}}'  AND T_en.language  = 'en'
          AND T_disp.type  = '{{{type}}}'  AND T_disp.language = '{{{lang|en}}}'
|fields  = IF(CONCAT('{{{1|}}}') != '', '', IF('{{{link|}}}' != '', '{{{link}}}', T_en.name)) = link, T_disp.name = text, T_disp.language = lang
|format  = template
|template= Link/render
|named args = yes
|limit  = 1
|more results text=
}}</includeonly>

Latest revision as of 18:38, 27 June 2026

This template is meant to handle the linking of articles in a way that is language-agnostic, meaning that it can be used in language-aware infoboxes and other contexts which need to be able to handle multiple languages. This template only works with concepts which have their translation managed by Cargo.

Notes:
    This template is just a wrapper for {{LinkIcon | filename=0 | ...}}. For more examples, see Template:LinkIcon.

Input: {{Link | id=human | type=faction}}

Output: Temple