Re 1: Hash starts off as
$page->{$id}-{'parent'}, but for readability's sake I created a second, ordered array of hashes that was the original IDs mapped to an array index showing the correct display order (ie, sorted by 'treepath'). It was just easier to visualise.
Nice code, but one thing's not as it should be (which I implied, but didn't specify *explicitly* before). I need the nodes to display in order (to allow users to build the order they want pages displayed in when menus are drawn, so they need to be sorted by 'treepath', eg:
#one
+ #two
| \ #five
| \ #boo
| \ #baz
\ #three
+ #four
+ #yak
\ #six
+ #foo
| \ #yuk
\ #ggg
and not the re-ordered way that your code outputs the tree at the moment, if that makes sense.
But thanks for the insight. I'll have a little play with the ideas you presented.
cLive ;-)