Re: How do I make a HTML tree for a set of nodes?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At 3:38 PM +0200 6/4/06, Niels wrote:
>On Sunday 04 June 2006 15:30, tedd wrote:
>
>[snip]
>
>> You can dynamically generate a table and place text (and/or color) the
>> cells that are nodes -- that would be my approach. You would need to know
>> the width and depth of the tree and then just fill in the cells that are
>> nodes.
>>
>> hth's
>>
>> tedd
>
>Yes, well... It's a tad more complicated I think. Yes, I can make a table,
>finding the dimensions shouldn't be a big problem. Placing the nodes in the
>right cells isn't as easy, and making the connections is downright
>difficult.
>
>A problem with using a table is that cells can't be individually sized.
>However DIVs or TDs is a minor problem. The major problem is to walk
>through the tree properly (recursively probably), and remember the
>connections. And then rendering them...

I've done this before, but not with html.

My demo is at:

http://www.sperling.com/freeware.php

So, I have an idea of what's involved.

If this just for display, then it shouldn't be too difficult to display the end results in a table -- provided, you know in advance the largest any row will be. It will be a simple grid, unless you want to play with column spacing, which will be very difficult indeed to manage.

As for cells not being individually sized, you're right they can't be sized, but they do automatically size to their contents and that can be varied as well shown with different background colors.

Are you going to use this for something other than display, is it functional in some way? Because if you're going to add functionality, such as editing, deleting, sorting, then you have a big chore in front of you.

As for using recursive functions, absolutely -- they make the process (and code) much less. However, you need to wrap your mind around things spinning around to their conclusion, which is sometimes difficult to imagine.

Good luck.

tedd
-- 
------------------------------------------------------------------------------------
http://sperling.com  http://ancientstones.com  http://earthstones.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux