Difference between revisions of "Template:HadezUtilRealmLink/doc"
Wraith0x29a (talk | contribs) m (Clarified what it does.) |
Wraith0x29a (talk | contribs) (Clarification and how to adapt existing templates.) |
||
Line 1: | Line 1: | ||
===Summary=== | ===Summary=== | ||
− | + | <nowiki>{{HadezUtilRealmLink|REALM_NAME}}</nowiki> | |
− | If wiki page 'REALM_NAME (Realm)' exists it links to that page. | + | A utility template - when passed a realm name it returns a link to the realm page even when a region of that name also exists. |
− | If | + | |
+ | If wiki page 'REALM_NAME (Realm)' exists it links to that page with REALM_NAME as the link text.<br> | ||
+ | If only the wiki page 'REALM_NAME' exists it links to that page.<br> | ||
If neither exist it shows REALM_NAME in plain text. | If neither exist it shows REALM_NAME in plain text. | ||
The template can be called using named or numeric parameters. | The template can be called using named or numeric parameters. | ||
+ | |||
+ | The template returns the link or text with no surrounding spaces. | ||
nb. This template would usually be invoked from within another template or dynamically generated list. | nb. This template would usually be invoked from within another template or dynamically generated list. | ||
Line 24: | Line 28: | ||
<nowiki>| realm=REALM_NAME</nowiki><br> | <nowiki>| realm=REALM_NAME</nowiki><br> | ||
<nowiki>}}</nowiki> | <nowiki>}}</nowiki> | ||
− | |||
− | |||
<b>Using Numeric Parameters</b> | <b>Using Numeric Parameters</b> | ||
<nowiki>{{HadezUtilRealmLink|REALM_NAME}}</nowiki> | <nowiki>{{HadezUtilRealmLink|REALM_NAME}}</nowiki> | ||
+ | |||
+ | |||
+ | ====Adapting Existing Templates==== | ||
+ | |||
+ | For use in existing templates, simply change.. | ||
+ | |||
+ | <nowiki>[[ {{#external_value:realm}} ]]</nowiki> | ||
+ | |||
+ | ..to.. | ||
+ | |||
+ | <nowiki>{{HadezUtilRealmLink|realm={{#external_value:realm}}}}</nowiki> | ||
+ | |||
+ | ..assuming you had the realm name assigned to the external_value called 'realm'. |
Latest revision as of 02:53, 31 January 2011
Summary
{{HadezUtilRealmLink|REALM_NAME}}
A utility template - when passed a realm name it returns a link to the realm page even when a region of that name also exists.
If wiki page 'REALM_NAME (Realm)' exists it links to that page with REALM_NAME as the link text.
If only the wiki page 'REALM_NAME' exists it links to that page.
If neither exist it shows REALM_NAME in plain text.
The template can be called using named or numeric parameters.
The template returns the link or text with no surrounding spaces.
nb. This template would usually be invoked from within another template or dynamically generated list.
Author: Wraith0x29a
Parameters
realm or param #1 : The name of the realm as it appears in the game.
Usage
Using Named Parameters
{{HadezUtilRealmLink
| realm=REALM_NAME
}}
Using Numeric Parameters
{{HadezUtilRealmLink|REALM_NAME}}
Adapting Existing Templates
For use in existing templates, simply change..
[[ {{#external_value:realm}} ]]
..to..
{{HadezUtilRealmLink|realm={{#external_value:realm}}}}
..assuming you had the realm name assigned to the external_value called 'realm'.