You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Bertrand Delacretaz <bd...@apache.org> on 2009/09/24 11:15:50 UTC

Re: OT: iterators/for-each loops (Re: sling.include only follows one path)

Hi,

On Thu, Sep 24, 2009 at 7:06 AM, Markus Pallo <pa...@dig.de> wrote:

> ...I made a test and changed wall/html.esp as seen below.
> i before include is "1" and after include its "3".
> So "i" of the wall is changed by having also "i" in brickgroup template.....
>
>
>
> ---------------------------
> brickGroups = wall.getBrickGroups();
> for (i = 0; i < brickGroups.size(); i++) {
> %>
> i before include <%= i %><br/>
> <%
>  sling.include(brickGroups.get(i).getPath());
> %>
> i after include <%= i %><br/>
> <%
> }
> -----------------------

Could you check if the http://issues.apache.org/jira/browse/SLING-1111
patch makes a difference?

Apart from that it's certainly a bug if the script called by
sling.include changes variables in the calling scope...thanks for
catching that, and if you can create a JIRA issue that would be great.

-Bertrand

Re: OT: iterators/for-each loops (Re: sling.include only follows one path)

Posted by Christoph Papke <pa...@dig.de>.
Bertrand Delacretaz schrieb:
> Hi,
>
> On Thu, Sep 24, 2009 at 7:06 AM, Markus Pallo <pa...@dig.de> wrote:
>
>   
>> ...I made a test and changed wall/html.esp as seen below.
>> i before include is "1" and after include its "3".
>> So "i" of the wall is changed by having also "i" in brickgroup template.....
>>
>>
>>
>> ---------------------------
>> brickGroups = wall.getBrickGroups();
>> for (i = 0; i < brickGroups.size(); i++) {
>> %>
>> i before include <%= i %><br/>
>> <%
>>  sling.include(brickGroups.get(i).getPath());
>> %>
>> i after include <%= i %><br/>
>> <%
>> }
>> -----------------------
>>     
>
> Could you check if the http://issues.apache.org/jira/browse/SLING-1111
> patch makes a difference?
>
> Apart from that it's certainly a bug if the script called by
> sling.include changes variables in the calling scope...thanks for
> catching that, and if you can create a JIRA issue that would be great.
>
> -Bertrand
>   
Hi Bertrand,

the patch submitted in SLING-1111 didn't solve the problem of the shared 
variable scopes in esp templates. I think it would make sense to create 
a new JIRA issue for this bug.

Christoph