$rx.asmhelper.mapValues

All,

i have a query in a template, i’m then using:

#set($language = $rx.asmhelper.mapValues($test,‘language’))

to output:

[English, Français, Italiano, Deutsch]

I now need to remove the square brackets and loop through these results to put them in a <ul>. Has anyone done anything similiar or knows of a workaround?

Thanks in advance.

Just a thought, but that looks like it might be a list, so you might be able to get by with a “foreach” statement on $language.

Thanks,

i have now got:

#foreach ($language in $test)
<li>$language</li>
#end

which is displaying:

[ul]
[li]{language=English}
[/li][li]{language=Français}
[/li][li]{language=Italiano}
[/li][li]{language=Deutsch}
[/li][/ul]

but i still have the curly brackets which i need to remove?

Ignore that - i changed it to:

#foreach ($language in $language)

and it is coming through clean.

Is it possible to concatenate two ‘for each’ statements? For example:

#set($language = $rx.asmhelper.mapValues($test,‘language’))
#set($localecode = $rx.asmhelper.mapValues($test,‘localestring’))

#foreach ($localecode in $localecode)
<li><a href="/$localecode/">$localecode</a></li>
#end

i want the $localecode as the link and the language as the title. Hope that makes sense.

I managed to get it working by concatenating the strings in the sql. It’s all working now.