You are here: Foswiki>Tasks Web>Item9449 (17 Mar 2011, GeorgeClark)Edit Attach

Item9449: FOREACH macro should expand within STARTSECTION type=expandvariables

Priority: Normal
Current State: New
Released In: n/a
Target Release: n/a
Applies To: Extension
Component: ForEachPlugin
Reported By: VickiBrown
Waiting For:
Last Change By: GeorgeClark
If I have a topic template containing this code

%FOREACH{"host" in="%URLPARAM{"Hostgroups"}%"}%
   * $host

and I create a page using this templatetopic, passing ...&Hostgroups=a%2C+b%2C+c%2C+d

I expect to get

   * a
   * b
   * c

in the resulting page.

%FOREACH should be run and expanded when the template is copied.

-- VickiBrown - 10 Aug 2010

Corrected spelling in the component field.

This could be a simple or complex fix; ForEachPlugin doesn't use registerTagHandler(), so as usual these types of macros are difficult to make consistent when it comes to edge cases in macro expansion behaviour.

For what it's worth, Foswiki 1.1's FOREACH macro accomplishes nearly the same thing and is in fact implemented with registerTagHandler()

-- PaulHarvey - 11 Aug 2010

Thanks. We'll look into Foswiki 1.1's FOREACH macro when we can. That may be a simler way to go. (Is if backward compatible to the Plugin? We have a LOT of pages...)

-- VickiBrown - 11 Aug 2010

No, it operates in a very different way. I will try to create an FAQ for how they're different and how to re-work your wiki apps to use the new macro.

We are tracking the issue in Item2382. I have made it a release blocker because you are not the only one that will be burnt by the new feature conflicting with the old plugin.

-- PaulHarvey - 12 Aug 2010

ItemTemplate edit

Summary FOREACH macro should expand within STARTSECTION type=expandvariables
ReportedBy VickiBrown
Codebase trunk
SVN Range
AppliesTo Extension
Component ForEachPlugin
Priority Normal
CurrentState New
TargetRelease n/a
ReleasedIn n/a
Topic revision: r5 - 17 Mar 2011, GeorgeClark
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy