Xiloynaha
Joined 13 August 2008
Latest comment: 16 years ago by Xiloynaha in topic LoopFunctions
LoopFunctions
editHi,
you provided a patch for LoopFunctions. Have you used the foreach-function yourself? I filled in the missing 'return'-variable but it still doesn't do anything. The condition for the "for (...)"-expression is never true so the return value stays empty.
tia Jörg
- Hello (and sorry for the delay, I was on vacation),
- Is it you the 217.6.3.114 talking on Extension_talk:LoopFunctions? On MW 1.12, I have no message about the return variable (strange…). I fixed that; is it that way you fixed yourself?
- You can see an example of using foreach here (don't hesitate to modify this page or the template Test, if you want to try something). Maybe you should show me your code and/or test it on my wiki. (Note that my test code worked fine even before adding the return declaration.)
- --Xiloynaha 20:36, 30 August 2008 (UTC)
- I added a simple template from my site to yours (http://oniropaedia.lm7.fr/index.php/Mod%C3%A8le:Personen) and also added another page to test the template (http://oniropaedia.lm7.fr/index.php/Test). The result is the same as on my site - none. This template works perfectly on mediawiki 1.10 with the unmodified version of loopfunctions though. Do I have to use the extension differently now? Thanks again for your response!--Jailing 09:45, 16 September 2008 (UTC)
- I found the trouble : it seems that you need now to explicitely name the parameters when you call your template. See my changes on http://oniropaedia.lm7.fr/index.php/Mod%C3%A8le:Personen and http://oniropaedia.lm7.fr/index.php/Oniropædia:Bac_à_sable#Personen_template (I moved the Test page you created into this one, because it is our "official" sandbox).
- I will try to fix that (I have to find time!).
- --Xiloynaha 07:25, 19 September 2008 (UTC)
- Thanks for your time and your quick response again. It's good to hear that this will be sortet out! A lot of my Templates on my site depend on this extension and I guess so do other sites. --Jailing 08:25, 19 September 2008 (UTC)
- I found that adding the numbered arguments fixed my problem:
- Thanks for your time and your quick response again. It's good to hear that this will be sortet out! A lot of my Templates on my site depend on this extension and I guess so do other sites. --Jailing 08:25, 19 September 2008 (UTC)
- I added a simple template from my site to yours (http://oniropaedia.lm7.fr/index.php/Mod%C3%A8le:Personen) and also added another page to test the template (http://oniropaedia.lm7.fr/index.php/Test). The result is the same as on my site - none. This template works perfectly on mediawiki 1.10 with the unmodified version of loopfunctions though. Do I have to use the extension differently now? Thanks again for your response!--Jailing 09:45, 16 September 2008 (UTC)
$variables = $frame->namedArgs + $frame->numberedArgs;
- I'm pretty sure this is not how it is supposed to be but it works for me. If you find a more subtle solution, please let me know. --217.6.3.114 22:05, 21 September 2008 (UTC)
- It works well, and actually it seems to be the normal way to do it. Thank you, I updated the extension page. Note that you cannot mix numbered and unnumbered args : the "duplicated" numbers will disappear.
- --Xiloynaha 19:25, 23 October 2008 (UTC)