This shows the entire tree built by add_node():

one
one_l2
one_l3
one_l4
two_l2
two
one_l2
two_l2
one_l3
one_l4
two_l4
three_l4
node3

This demonstrates traversing the tree one node-level at a time. You can verify the traversal by the expanded output above:

Go to Root

one
expand
two
expand
node3
expand

This structure comes explicity from an actual directory tree:

Treeview
Folder1
Folder1
Images
onion.gif
Documents
Folder2
Folder1
Folder2
Folder1
test.txt

Test using template defined in __DATA__ section of treeview.cgi (uses <blockquote> rather than <div>):

Treeview
Folder1
Folder1
Images
onion.gif
Documents
Folder2
Folder1
Folder2
Folder1
test.txt