Expand my Community achievements bar.

SOLVED

variable within variable in sightly

Avatar

Level 6

I want to access one sightly variable in another sightly object .

Eg :

i have one sightly variable ${temp} which is an integer

I want to use the above variable in sightly array variables  ${variable.arrayObj[${temp}]}

Is there any i can access ${temp} with the array object ?

1 Accepted Solution

Avatar

Correct answer by
Employee

this works for me..:

<div data-sly-list="${[0,1]}">
item ${item} value ${properties.cq:tags[item]}<br/>
</div>

View solution in original post

5 Replies

Avatar

Employee

can you try   ${variable.arrayObj[temp]}

Avatar

Community Advisor

have u tried following  ${variable.arrayObj[temp]} ?

- Runal

Avatar

Level 6

 ${variable.arrayObj[temp]} did not work

Avatar

Correct answer by
Employee

this works for me..:

<div data-sly-list="${[0,1]}">
item ${item} value ${properties.cq:tags[item]}<br/>
</div>