Extension talk:Loops/LQT Archive 1

Feedback
Doesn't only work on MW 1.12 Alpha, works also on 1.12. I hope it also will work on 1.13. This extension is very helpful, for example for building well arranged templates without copy paste and change 100 times for "array" parameters. Found no Bugs as yet. Hope somone will develope on this extension that we can see it with stable Status as soon as possible! --77.191.205.221 10:13, 6 August 2008 (UTC)


 * Thanks for the feedback! Though no one has reported any bugs, I know of only three or four people who use this extension (present company included), so I don't feel comfortable updating the status to "stable" yet.  —Sledged (talk) 15:59, 6 August 2008 (UTC)


 * I use this extension! . I have a template calling it here.  We discuss the necessity of this template all the time on the mailing list. Keep up the great work! --Aquatiki 22:09, 6 August 2008 (UTC)


 * Glad to know it works well for you. I'll go ahead and change it to stable, since no bugs have been found with the bread-and-butter functions (while and dowhile).  foreachnamedarg, however, is still experimental and subject to change.  —Sledged (talk) 18:26, 21 August 2008 (UTC)


 * I use this extension, too! . It's crucial to my [|Random Image Gallery] template as used on the homepage. Awesome work! --Arodicus 22:36, 8 October 2008 (UTC)

Ok, It also works on MW 1.13.1, tested now! --77.191.216.80 15:03, 30 September 2008 (UTC)

Foreachnamedarg
Foreachnamedarg is really amazing! But why don't you allow to use it without prefix? I have some templates where I allow the users to use parameter 1, 2, 3 and so on without any limitation, I really could use it there so I would save the increment variable, the condition and the asigning of the parameter value to a variable. If Foreachnamedarg is significant faster than the common loops or it allows to do more loop runs than the other loops before you get a php error message because of memory or something, It would a fortiori make sense to allow it. With many loops in my pages they get really slow sometimes. --Danwe 21:38, 13 February 2009 (UTC)


 * I'm glad you find it useful. Foreachnamedarg is a pilot parser function for an idea I'm still fleshing out.  Eventually, I plan to replace it with foreacharg which will do exactly what you're describing while still keeping the current functionality.  I have no time frame for this though.  —Sledged (talk) 20:07, 19 February 2009 (UTC)

Bug #1 - Invisible characters around generated text of the loop
Phew, I spent two evenings now untill I found that bugs source... It seems like the Bug is, that the Loops extension creates some invisible characters arround the text which is created inside the loop. So when you run a loop to create some text for a template the length of the text the template will return is much longer than the text you can see. In some cases this behavior causes problems, for example when you use the return value with string functions or inside a Semantic Media Wiki Property.

Example: The following loop: would return the output "01234", looks like its 5 chars long. But the #len function couns exactly 220 (!) characters!

I found a litte workarround for that: You can use the sub parser function from string functions to avoid this:   but you have to store the generated return value in a variable if it is generated in the loop because the variable has to print their content behind the loop and sub function. So return values of templates dont give back some invisible characters and you can use the string wherever you want without problems.

I hope you will fix this litte bug soon, I dont like my workarround pretty much :-/

--77.191.145.123 19:20, 29 January 2009 (UTC)


 * Try it without the &lt;nowiki/&gt; tag, like so:


 * and see how it works. I use the nowiki tags in my examples so that the new line characters immediately after the tags are preserved.  —Sledged (talk) 20:39, 29 January 2009 (UTC)


 * Thank you, this works like expected! --77.191.253.66 22:33, 1 February 2009 (UTC)

Help me please
I can't seem to get this to work: In my wiki theres a table at the bottom of many pages that go to different versions of the content on the page, so i want to use a template instead. I want to make a table that has one row (starting with the row heading "Inputs" in bold and the two-input version), and in each cell links to a page called: (first parameter) then "_(" then the i value then " bit)" with a label of the value of i. the variable i increments by 2 until i is less than the second parameter. Below is my attempt but it always seems to time out.

Example: Should produce:


 * You need to hide the pipe character after &lt;nowiki/&gt; tag in a template. Otherwise, MW thinks it's the start of another parameter.  Standard practice is to create the template Template:!, whose only content that is included is a pipe character.  —Sledged (talk) 18:01, 30 December 2008 (UTC)