BUU has asked for the wisdom of the Perl Monks concerning the following question:
I have what I thought was a fairly simple problem, but after several days of pondering I can't find a good solution. I have an array the contains a tree. It's a flat array, containing the results of a depth first iteration over the tree. Think find(1) read in to an array. Now each element in the array also contains it's depth, or what level of the tree it's on.
I want to display this array as a indented tree, with each level being indented further from the left. The cleanest way to do this in html/css I feel is to nest containers. Each container has, say, margin-left: 10, then you simply open a new one for each level and you get your nicely indented tree. But that's the problem, how would I accomplish that using the power of HTML::Template? I confess I've got no ideas that don't involve ugly hacks to my data and the template (such as storing a special variable in the array every time it changes level). Anyone got a better idea?
I want to display this array as a indented tree, with each level being indented further from the left. The cleanest way to do this in html/css I feel is to nest containers. Each container has, say, margin-left: 10, then you simply open a new one for each level and you get your nicely indented tree. But that's the problem, how would I accomplish that using the power of HTML::Template? I confess I've got no ideas that don't involve ugly hacks to my data and the template (such as storing a special variable in the array every time it changes level). Anyone got a better idea?
Back to
Seekers of Perl Wisdom