Extension talk:LoopFunctions

can you please provide a foreach function that will take a text, separator, param pattern, output separator, replacement and, will split the text with the first separator, iterate over the resulting array, replacing the param in pattern (so if an item is foo1_bar, and the param pattern is foo$n$_bar, then $n$ is 1), creating another array that is then joined with the output separator?

LoopFunctions + VariablesExtension
So I'm trying to combine these two extensions with frustrating results. If I have the following:

*

I get these results:


 * 0
 * 1
 * 1
 * 1
 * 1
 * 1
 * 1
 * 1

It looks like the #vardefine and #var functions inside the loop are getting resolved before the loop even starts. For the life of me, I can't figure out if it's a problem with the LoopFunctions, the VariablesExtension, or both. &mdash;Sledged 22:37, 19 January 2007 (UTC)


 * I tried to help you out...I guess you can't nest for loops.

{{#for:7 | {{#expr:+1}} {{#for:1 | {{#vardefine:odd|{{#expr:+1}} }} }}


 * Mcpaige 04:47, 28 February 2007 (UTC)


 * Fortunately, I've found a solution. —Sledged (talk) 04:14, 25 September 2007 (UTC)

LoopFunctions + Template
This might not be the best way to do this, but here goes.

On page Table I put  , the template TheInfoList looks like this   . There are a bunch of templates named TheInfo1, TheInfo2, TheInfo3, TheInfo... which actually in turn look like this   and of course TheInfo handles all the html and formating and stuff. The loop does not handle templates, what I get on page Table is
 * Template:TheInfo1
 * Template:TheInfo2
 * Template:TheInfo3
 * Template:TheInfo4

with links, the templates are not being included. Any ideas ? Mcpaige 04:26, 28 February 2007 (UTC)


 * This is along the lines of the mentioned limitation. I expanded that section.--Patrick 12:09, 28 February 2007 (UTC)

Hooks (aka "Custom HTML Tags")
They don't seem to work inside a looping function.

I have Extension:Colorize installed and when I do this:

NS:Somepage

Template:foo

I get this: 1 2

As you can see, the "rep$n$" ouside of the "colorize" hook gets replaces as expected, but not the one inside.

Edit: It doesn't matter if I "include" Extension:Colorize before or after Extension:LoopFunctions in LocalSettings.php

Egingell 03:42, 27 April 2007 (UTC)

Version Special Page disappears
Im using Mediawiki 1.10, and as long as the LoopFunctions extension is installed, my Version-Page is just empty. Any idea? --Die Backe, 91.3.112.102 12:38, 29 May 2007 (UTC)
 * This is caused by the special u with double dot character in the author's name. Edit LoopFunctions.php and change this character in the version array construct to a simple 'u'.  Sorry author. 60.240.113.86 14:23, 1 July 2007 (UTC)

Notice: Undefined variable
Any idea why I'm getting this notice? Notice: Undefined variable: return in /foo/wiki/extensions/LoopFunctions/LoopFunctions.php on line 67 --D0li0 01:27, 12 October 2007 (UTC)
 * 1) How do you disable the Notice messages?
 * 2) How do you define a "local" variable such as the $return variable in question?


 * Someone needs to add the following line to the public function foreachHook in the LoopFunctions.php to prevent the error above due to the uninitialized variable $return. This is not unlike the function above foreachHook, but needs to be done again as the variable is not a global.

$return = '';
 * And out of curiosity, it is wise to use a variable named return? Why not output, myfooness or something that is not a reserved word? --D0li0 21:45, 12 October 2007 (UTC)