On Tue, May 15, 2012 at 10:55 AM, Moritz Hesse (EA GmbH)
<moritz.hesse(a)ea-gmbh.de> wrote:
What is an appropriate way to structure
multidimensional arrays in velocity?
Let's say I want to have a main topic with two subtopics with three elements
each:
1 maintopic
1.1 subtopic1
1.1.1 one
1.1.2 two
1.1.3 three
1.2 subtopic2
1.2.1 one
1.2.2 two
1.2.3 three
My approach would be:
{{velocity}}
#set( $maintopic = ["subtopic1", "subtopic2"] )
#set( $maintopic.subtopic1 = ["one", "two", "three"] )
#set( $maintopic.subtopic2 = ["one", "two", "three"] )
{{/velocity}}
$maintopic is a List here and not a Map so $maintopic.subtopic1 does
not mean anything.
try with
#set( $subtopic1 = ["one", "two", "three"] )
#set( $subtopic2 = ["one", "two", "three"] )
#set( $maintopic = {"subtopic1" : $subtopic1, "subtopic2" :
$subtopic2} )
But I cannot access the one-two-threes in each subtopic. What am I doing
wrong?
Thanks and best regards,
Moritz
_______________________________________________
users mailing list
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users
--
Thomas Mortagne