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?
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|