Luke Plant wrote:
On Wed, 18 Jan 2006 21:22:29 +0100 gabor wrote:
i'm trying to use the unordered_list filter, with little success :(
i tried the provided example ( ['States', [['Kansas', [['Lawrence',
[]], ['Topeka', []]]], ['Illinois', []]]] ),
and it works,
but i am unable to understand it.
It uses an empty list to indicate the end of a list, I'm not sure
exactly why :-).
my first guess is that because you have to somehow stop the recursion,
and if you would just do a normal foreach, then it would also 'enter'
strings, because they are indexable. but i can be wrong :)
hmmm.. after checking the sourcecode, it seems that it works with pairs,
and if the second item of the pair is false, then this pair designates a
leaf, otherwise he "sinks" deeper.
There are more examples in the tests (under
'othertests').
thanks for the help...
i checked them and they are interesting, but i'm still unable to create
a simple list.
anyway, it's 00:10AM already, so maybe in the morning this all will seem
simple to me :)
thanks for the help,
gabor