Template talk:Icon

From Lotro-Wiki.com
Jump to navigation Jump to search

Numbers inside

Can we keep the number inside the icon even when double digit? I notice anything above 10 puts the number below the icon instead of inside it. Rogue 10:23, 28 April 2011 (EDT)

Made few changes to the positioning when the stack is bigger. Seems to work ok at the different sizes. Amphoras 12:10, 28 April 2011 (EDT)

Non-existing icons

I added a feature which returns the File:-icon.png instead of a red link, but links the icon to the supposed-to-be icon file (if the "link=" parameter is not specified). --EoD (talk) 19:06, 17 October 2011 (EDT)

I made a page that links to a bunch of icons in a table. See the first table on this page: User:RingTailCat/Sandbox-4. I am getting the default icon () in the position where I should get the . If I click on the link in that cell, I get to the captain's emblem icon page. Needless to say I am baffled. Am I doing something wrong? Is there a difference between the icon pages for the captain's emblem and for example, the burglar's club? RingTailCat (talk) 12:23, 18 October 2011 (EDT)
You get an error message like on previewing the page:
Warning: This page contains too many expensive parser function calls.
It should have less than 100 calls, there are now 132 calls.
That sounds like the last 32 icons are not parsed for existence, therefore it's now shown. If you put it on a single line, it works flawless. I'll see what I can do about it.
--EoD (talk) 13:24, 18 October 2011 (EDT)
I see. I had not noticed the error message before. I moved the icons into a new page: User:RingTailCat/Sandbox-4-icons. This is a sandbox page, not intended to end up as a regular page. Still, it is a handy summary of the legendary item icons. I hope you can come up with a solution. RingTailCat (talk) 14:23, 18 October 2011 (EDT)
There is no real solution to that (apart from removing the 2nd ifexist check in Template:Icon and therefore allowing twice as many icons), but Lotroadmin helped to support more icons per page (now 500, before 100). See also here. --EoD (talk) 18:57, 18 October 2011 (EDT)
Thanks. I followed some of the discussion about this issue. It sounds like we should be able to have 250 references to the Icon template on a page now. It would be nice if we could have something like the browser's broken image like place-holder. I wonder if it is something that could be handled in javescript at the browser? If there is not icon image, use the default. Maybe it needs an extension that operates at a lower level than the parser, and emits a reference to the first image that exists in a list of images. It kind of reminds me of the SQL functions NVL() or COALESCE(). RingTailCat (talk) 20:01, 18 October 2011 (EDT)

Transclusion category leakage

When transcluding a page that uses this template and it doesn't have an icon, the receiving page gets stuck with Template:IN and ends up in Category:Stubs/Icon which puts a lot more pages in that category to sift through than necessary. For example, Icon Wanted This file is marked for wanting a new icon. Please refer to Help:Images before uploading new icons.  This Item Has a Missing Icon .

It looks like a similar problem was remedied with encapsulating the categorization in an #ifeq statement checking to see if {{{disambigpage}}} == {{FULLPAGENAME}}. Would this solve the problem?

{{#ifeq: {{{disambigpage}}}|{{FULLPAGENAME}}|{{IN}}|}}

Neum (talk) 04:25, 13 June 2013 (EDT)

I think you are definitely on to something. At least you have identified an issue that I noticed some time ago, back when I was first look at Things to do.
I can't tell you about the efficacy of your proposed change as I don't know much about template coding... all I can say is -- try it in the sandbox and see what happens...! I say use the sandbox because the main template is used A LOT of times, and will generate lots of "updates" every time you "test."
I suspect that this change is likely to apply to other templates as well. I don't know how many such things exist, but I don't doubt there are more (maybe even many?).
Wm Magill - Valamar - OTG/OTC - talk 17:10, 26 June 2013 (EDT)
I just realized the TRUE implication of what you were saying -- "When transcluding a page that uses this template" -- it's not the original page which is the offender, but all of the other pages which clutter up the works! I've also noticed this problem with "what links here" where 90% of the links belong to transclued pages that don't really link back to the original page.
Wm Magill - Valamar - OTG/OTC - talk 17:18, 26 June 2013 (EDT)
I don't think that would work in this case, because the Template:Icon doesn't have a disambigpage parameter. It would always return false - it's not reading that information from the page that it's being transcluded into. You do want the categorization to show up in the page that transcludes this template, but not in the page that transcludes that page. This is reminding me strangely of Inception.
There must be something along those lines though. I'll keep mulling it over. -- Elinnea (talk) 19:45, 26 June 2013 (EDT)
Might the template be changed to put the {{IN}} or [[:Category:Stubs/Icon]] (whichever it is actually adding to the page when icon is missing) inside a <noinclude> block? Or put all the code generated by the template inside a noinclude if no icon is found? That way when the page is transcluded it hopefully should not cascade adding pages to the stub category. However instead of the question mark icon, you would just have a blank spot. Another possibility is the template adds the question mark icon as legitimate icon without adding stub category for transcluded pages. Since I don't know much about template coding either, I don't know how feasible anything I just said is.
-Shardis (talk) 23:41, 26 June 2013 (EDT)

Missing Icon vs Other Templates

This template, when the icon is not found, damages tables that transclude pages using templates such as Trait or Skill. Example: The Martial Champion Traits (Riposte). --Eirik Ratcatcher (talk) 02:57, 8 February 2014 (UTC)

Thanks for the catch and the temporary fix to the affected pages. Could you {{Stub/Skill}} the skill pages where you need to take out the broken link so someone knows to go find those icons at some point? Not sure how quickly anyone will get around to fixing this template, sadly. Sethladan 14:44, 8 February 2014 (UTC)
Not sure if this was the case back than, but the Icon template outputs other content in case the icon does not exists and breaks the default mediwiki table cell formating. I would recommend for us to use the full table syntax eg:
|-
| {{:item|mode=imlink}}
| cell 2
| cell 3
|-

instead of the shorthand for putting multiple cells on one line, which can get broken if something not expected is included in one of the cells.

|-
| {{:item|mode=imlink}} || cell 2 || cell 3
|-

--Drono (talk) 11:11, 6 October 2021 (UTC)

Bug

There seems to be a [bug] with this where in narrow parent, the stack number appears in the wrong place.

The way the number is currently overlayed seems more complex than it need to be, unless I'm missing something. It seems simpler to just put the text inside the anchor and set the anchor background as the icon image. Here are some examples (but there are lots of ways to do this), I've included seperate css too for ease of reading...

-Garlo (talk) 14:16, 2 April 2022 (UTC)

OK, I see the issue, they don't let you use anchor tags or styles on links or on image links... so maybe:
5
although at this point it's not much simpler from the original. It doesn't seem to have the bug though. - Garlo (talk) 15:40, 2 April 2022 (UTC)

Proposed v1

<div style="display:inline-block;vertical-align:middle;">[[Image:+10% Run Speed Boost-icon.png|32px|link=Item:+10% Run Speed Boost (60 min)]]<div class="icon-stack" style="line-height:1em;margin-top:-1em;text-align:right;pointer-events:none;">5</div></div>

Proposed v2

<div style="display:inline-block;vertical-align:middle;position:relative">[[Image:+10% Run Speed Boost-icon.png|32px|link=Item:+10% Run Speed Boost (60 min)]]<div class="icon-stack" style="line-height:100%;text-align:right;pointer-events:none;position:absolute;bottom:0;right:0;">5</div></div>

Current

Added a second version and comparison. Any thoughts on this, as it's bugged like this on the front page, so would be good to get it fixed. Are you all seeing the stack count in the wrong place above? Any preference regarding the fix? - Garlo (talk) 15:41, 5 April 2022 (UTC)
I would prefer the number as it is a little bit padded from bottom so probably second version with bottom 1 or 2 px. Would also like to make it so we are able overlay 2 (or more if needed) icons over each other - would allow us to upload essence overlays and display the numbers on them. --Drono (talk) 17:21, 5 April 2022 (UTC)
Overlaying might also allow us to make it so the ? icon is displayed as default so not breaking layouts on items without icon, be we might be able to skip the expensive check if the file exists. --Drono (talk) 17:27, 5 April 2022 (UTC)