I noticed in a recent cvs log from donb that he mentioned some portion of portals would be easier if nested list tags were allowed. I wondered what was keeping them from being used and started digging into the code.
It turns out most of the functionality to use nested lists already exists in templating. The one problem keeping it from working is that the for loops use the same index variable. I fixed this in my site and nested loops immediately started working.
As I glanced through the templating code, I noticed an undocumented feature of lists was the ability to pass a list datastructure into the list by using a value="" parameter. You name this "new" list by using the name="" parameter, just as you would if the list originated from the tcl file. That's what makes everything work. Happily, this fix should be completely backward compatible.
Here's what nested lists would look like in an adp file:
<list name="outer_list">
Outer Item Number: @outer_list:rownum@<br>
<list name="inner_list" value="@outer_list:item@">
item: @inner_list:item@<br>
</list>
<br>
</list>
With an list structure of: { {1 2 3 4} {a b c d} },
the output result is:
Outer Item Number: 1
item: 1
item: 2
item: 3
item: 4
Outer Item Number: 2
item: a
item: b
item: c
item: d
To me, the most exciting thing is that this makes it possible to have a list structure as part of a multirow. Like this:
<multiple name="test">
@test.name@<br>
<list name="foo" value="@test.mylist@">
item: @foo:item@
</list>
<br>
</multiple>
I guess the question is, would this be considered a bug-fix, or a new feature? Is a TIP in order, or can it be commited to the upcoming 5-1 tree?