Template:Name: Difference between revisions

From Dreamlight Valley Wiki
Jump to navigation Jump to search
(remove crafting hack)
Tag: Manual revert
No edit summary
Line 1: Line 1:
<span id="nametemplate" {{#ifeq:{{{class|}}}|inline|style="display:inline; margin-right:0;"|}}><span id="name-space" style="width:{{#if:{{{size|}}}|{{{size|}}}px|}};">[[File:{{#if:{{{image|}}}|{{{image|}}}|{{{1|}}}.{{{ext|png}}}}}|{{#if:{{{size|}}}|{{{size|}}}|20x20}}px|link=]]</span> {{#if:{{{link|}}}|[[{{{link|}}}]]|{{#switch:{{lc:{{{1|}}}}}
<includeonly><span id="nametemplate" {{#ifeq:{{{class|}}}|inline|style="display:inline; margin-right:0;"|}}><span id="name-space" style="width:{{#if:{{{size|}}}|{{{size|}}}px|}};">[[File:{{#if:{{{image|}}}|{{{image|}}}|{{{1|}}}.{{{ext|png}}}}}|{{#if:{{{size|}}}|{{{size|}}}|20x20}}px|link=]]</span> {{#if:{{{link|}}}|[[{{{link|}}}]]|{{#switch:{{lc:{{{1|}}}}}
|#default=[[{{{1|}}}]]}}}}{{#if: {{{2|}}}|&nbsp;({{{2|}}})|}}</span><noinclude>[[Category:Formatting templates]]</noinclude>
|#default=[[{{{1|}}}]]}}}}{{#if: {{{2|}}}|&nbsp;({{{2|}}})|}}</span></includeonly><noinclude>{{{{FULLPAGENAME}}/doc}}</noinclude>

Revision as of 19:40, 18 March 2023

Description

This template is used to insert an image next to an article name, resize the image to 20px wide, create a link to the article, and a parameter to display quantity or other detail after the article name and link.

Image size can be adjusted using the parameter "size".

Usage

This template can be used by entering the following onto a relevant page.

{{name|''item name''|''detail''}}

Optional Parameters

If used together with "detail" these should be entered after the detail value.

  • size=Adjust the width in px the image displays at (e.g. size=32)
  • image=Overrides the image matching the item name (e.g. image=Mickey Mouse.png)
  • link=Link to an alternative page

Examples

The most common use of this template doesn't define parameters by name, but by order.

{{name|Apple|5}}

results in...

Apple.png Apple (5)

{{name|Buzz Lightyear's Space Pack}}

results in...

Buzz Lightyear's Space Pack.png Buzz Lightyear's Space Pack


Optional Parameter Examples

The "detail" parameter can be any value, including another template

{{name|Donald Duck|{{price|100}}}}

results in...

Donald Duck.png Donald Duck (Star Coin icon.png 100)

The parameter "size" overrides the default (20px) image size

{{name|Wedding Cake|3|size=48}}

results in...

Wedding Cake.png Wedding Cake (3)

Optional parameters can be used without a "detail" value

{{name|Scrooge McDuck|size=48}}

results in...

Scrooge McDuck.png Scrooge McDuck

By default the image and link are the "name" value. Each can be overridden using named parameters "image" and "link".

{{name|Goofy|image=Mickey Mouse.png}}

results in...

Mickey Mouse.png Goofy

{{name|Goofy|link=Mickey Mouse}}

results in...

Goofy.png Mickey Mouse

To provide different linked text but the same page link, use the standard MediaWiki syntax for escaping a pipe character in a template:

{{name|Cute Nightstand (2)|link=Cute Nightstand (2){{!}}Cute Nightstand}}

results in...

Cute Nightstand (2).png Cute Nightstand

Optional parameters can also be combined

{{name|Crab|3|size=36|link=:Category:Seafood{{!}}Seafood}}

results in...

Crab.png Seafood (3)