Template talk:Rating-5
From Wikipedia, the free encyclopedia
Contents |
[edit] Redundant?
Isn't this template somewhat superfluous since we have Template:Stars? --HarryCane 15:11, 22 September 2006 (UTC)
- This seems a lot more user-friendly than Template:Stars for the simple X-out-of-5 rating to me. - Rynne 01:55, 23 September 2006 (UTC)
- Well, I think we should prefer
Template:StarsTemplate:Rating-5 over Template:Stars, forit's a lot more flexible and powerful than thisthis looks much better. I hate seeing so many different templates by the way, we do really need a policy or something. What I'd rather avoid is an endless edit war on what is the coolest template. We choose a template, we use it. It's that simple! --Emc² (contact me) 16:37, 3 October 2006 (UTC)
- Well, I think we should prefer
[edit] Simplified version available
This template is overly complex. It can't be used many times on a page without hitting some limit. I simplifed the logic on the version installed on nowiki, now it's possible to use it many times on the same page. See no:Template:Rangering-5. ZorroIII 18:47, 6 February 2007 (UTC)
- This simplified version looks good, and is similar to how the other Rating templates I created were set up before I moved to a freeform system. However, I'm not sure what you mean about "limits". I've certainly never encountered this before. Does there exist an example of this limit in play? -- Huntster T • @ • C 20:32, 6 February 2007 (UTC)
- Have a look on no:Bruker:Kjetil_r/Liste, before I changed the template it failed a bit down on the list. See below aswell. The current implementation fails when there is more than 39 instances, due to it including lots of other templates. ZorroIII 23:11, 8 February 2007 (UTC)
- Wow, this is very interesting. Given that it fails on the 40th iteration, I wonder if this is a MediaWiki issue or if it can be fixed in the code somehow (I'm guessing the former). I'll have to perform some tests tonight to see if the other Rating templates perform the exact same way; perhaps that will shed some light. Also, out of curiosity, what is the topic of the page you linked to? I don't read the language, so I'm having a bit of trouble understanding it. -- Huntster T • @ • C 23:56, 8 February 2007 (UTC)
- Its a limit configured on the servers to avoid some (not so) clever templates hogging the servers to much, I think. The page I linked to is how Kjetil R on nowiki rates articles (on nowiki) about USA. ZorroIII 18:27, 9 February 2007 (UTC)
- Wow, this is very interesting. Given that it fails on the 40th iteration, I wonder if this is a MediaWiki issue or if it can be fixed in the code somehow (I'm guessing the former). I'll have to perform some tests tonight to see if the other Rating templates perform the exact same way; perhaps that will shed some light. Also, out of curiosity, what is the topic of the page you linked to? I don't read the language, so I'm having a bit of trouble understanding it. -- Huntster T • @ • C 23:56, 8 February 2007 (UTC)
- Have a look on no:Bruker:Kjetil_r/Liste, before I changed the template it failed a bit down on the list. See below aswell. The current implementation fails when there is more than 39 instances, due to it including lots of other templates. ZorroIII 23:11, 8 February 2007 (UTC)
[edit] Proposal for new code
{{editprotected}}
The complicated calculations in this template should be replaced with the following code: {{#switch: {{#expr: (2 * {{{1}}} round 0) / 2}} |0=[[Image:0 stars.svg|55px|1/5 stars]] |0.5=[[Image:0.5 stars.svg|55px|0.5/5 stars]] |1=[[Image:1 stars.svg|55px|1/5 stars]] |1.5=[[Image:1.5 stars.svg|55px|1.5/5 stars]] |2=[[Image:2 stars.svg|55px|2/5 stars]] |2.5=[[Image:2.5 stars.svg|55px|2.5/5 stars]] |3=[[Image:3 stars.svg|55px|3/5 stars]] |3.5=[[Image:3.5 stars.svg|55px|3.5/5 stars]] |4=[[Image:4 stars.svg|55px|4/5 stars]] |4.5=[[Image:4.5 stars.svg|55px|4.5/5 stars]] |5=[[Image:5 stars.svg|55px|4/5 stars]] |'''NO VALID RANK GIVEN''' }}
- ZorroIII 21:57, 14 February 2007 (UTC)
I intentionally moved away from this model because of the inflexibility of it. The current code allows for any numeral to be accepted, be it 1.5 or 3.7, which more than a few websites use for ranking. While there is an iteration limit, it will be very special circumstances in which that is a probem, in which case it is really just as easy to use the images by themselves. -- Huntster T • @ • C 23:18, 14 February 2007 (UTC)
- I don't see any advantages in the proposed version; it is longer and will fail on non-half-integer ranks. If you are concerned about the Template limits, we could move to the Template doc page pattern instead to mitigate the problem. (I don't see much of a problem, though, as I can't think of articles that need to transclude this template very often). Kusma (討論) 08:28, 15 February 2007 (UTC)
- The suggested code handles any numeral, be it 1.5, 3.7 or 3.1415. (see no:Bruker:ZorroIII/ratings). If someone set up a ranked list of, say, the 100 most popular movies, the current template would fail. See this example. The suggested code also includes no other templates and in my opinion is easier to read than the current code. ZorroIII 17:04, 15 February 2007 (UTC)
- The problem is, I cannot think of any good use of this template on long lists such as you describe that wouldn't be better served by simple text, or that would not involve the use of original research or point of view. However, I'll take a closer look at this proposed template, see if I cannot finagle it to perform as the current one does. Kusma, while I agree it probably isn't necessary, I'd be more than happy to convert the documentation to a /doc page if you'll unlock the Ratings pages for update once I'm finished. -- Huntster T • @ • C 17:35, 15 February 2007 (UTC)
- The suggested code handles any numeral, be it 1.5, 3.7 or 3.1415. (see no:Bruker:ZorroIII/ratings). If someone set up a ranked list of, say, the 100 most popular movies, the current template would fail. See this example. The suggested code also includes no other templates and in my opinion is easier to read than the current code. ZorroIII 17:04, 15 February 2007 (UTC)
[edit] New Template:Rating
Hey there. I've created a new template that hopefully supersedes the star rating {{Rating-3}}, {{Rating-4}}, {{Rating-5}}, {{Rating-6}} and {{Rating-10}}, since it unifies all these templates into one: {{Rating}}. Just write {{Rating|3|6}} to get , or {{Rating|2.5|8}} for . More examples can be found at the template page. Comments welcome. :) --Conti|✉ 02:19, 26 March 2007 (UTC)
[edit] Add iw
no:Mal:Rating-5 Nsaa 08:15, 12 August 2007 (UTC)
[edit] Display
For some reason none of the images are displaying anymore. The {{rating-10}} is working fine, but this template is just showing up as 4/5 stars instead of the image (see Oh No). Why is this, and what needs to be fixed? —Akrabbimtalk 17:12, 15 September 2007 (UTC)
- I just saw the answer over on the Village Pump; apparently Commons is having image difficulties right now (nothing new, really), and because all of the stars from this template and the others are stored on Commons, there is the chance any given image won't work. As soon as this problem is figured out, everything should return to normal, but nothing can be done in the interum. -- Huntster T • @ • C 23:06, 15 September 2007 (UTC)