Template talk:For

From Meta, a Wikimedia project coordination wiki
Jump to: navigation, search

phew[edit]

Is your brain also starting to bleed? :) AzaToth 10:31, 12 December 2005 (UTC)

I am fine. Writing the wikitext {{{a}}} as [a] in explanations/analysis is helpful.--Patrick 11:16, 12 December 2005 (UTC)
Made a comment on Help:Parameter default to perhaps use «» for that AzaToth 11:36, 12 December 2005 (UTC)

Table[edit]

All I want to do is create a template which takes an array of values and produces a nice table. Why are there 20 versions of different loop templates and extensions here, non of which do anything remotely useful? Everything is so jumbled together and unreadable that I'm about to give up.

There are two examples of producing a table with Template:For.--Patrick (talk) 01:35, 26 January 2008 (UTC)

categories[edit]

What I'm looking for is a way (if possible) to loop through all members of a category, and pull out some data that's defined in a template in the pages of that category... for instance, For all pages with the category "National Football League teams", display the "name" and "colors" parameters from the template Template:NFL team.

With the end result of a list of NFL team names and team colors, with the data only stored in one place. Is anything like this remotely possible? 24.196.67.58 18:43, 29 October 2008 (UTC)

Efficiency[edit]

You are aware that there's a more compact and efficient way to do this that does not involve the #ifeq +/-'s, the unnecessary "empty" parameter, or any of the undefined's right? If anybody wants, I can apply the necessary changes to this and for/aux.
--Cogniac 05:40, 5 December 2009 (UTC)

For the time being, for easy comparison, you could give your version another name.--Patrick (talk) 23:38, 6 December 2009 (UTC)
For your perusal: Template:Altfor and Template:Altfor/aux. Here is the only problem. It states on Help:Templates that "...Spaces and newlines are stripped from the start and end of parameter values of named parameters, but not of implicitly numbered parameters." This is a lie. If you look in the Sandbox, the delimiter should be ", " but the ending space is being stripped out. From {{{1}}}. The implicitly numbered parameter. It seems to be why you have the "empty" parameter in the delimiters in Template:For/aux. I'm going to go ahead and call this a bug. A possible rebuttal argument to this might be "But that's why I have the empty parameter and everything!" to which I reply "Implementing a workaround in the wiki code for the bug does not negate the fact that it is a bug."
--Cogniac 16:33, 7 December 2009 (UTC)
I put a demo of a workaround using the HTML whitespace code in the Sandbox. If the SoxBot clears it before you see it, just check the page history for my last edit.
--Cogniac 19:10, 7 December 2009 (UTC)
Re "lie": see Help:Newlines_and_spaces#Stripping_on_expansion: spaces and newlines are also stripped from the start and end of the expanded wikitext of the value of a parameter of a parser function (in your case #if). The HTML whitespace code is interesting, but not as convenient to use, and with substitution it gives codes that clutter the resulting wikitext.--Patrick (talk) 00:53, 8 December 2009 (UTC)
Well, I can see no way around the empty parameter trick, so you got me there, but my other fixes still stand as efficiency/readability improvements.
--Cogniac 22:44, 11 December 2009 (UTC)