hello guys, i m trying to generate hierarchical tree view, as per done in any MLM business, where binary level or unary level tree has made....
in my problem there is a super user, below him there are many sub users this level will be called 1st level.
after tht the user's of first level will contain another child user, tht will be 2nd level, after 2nd there is 3rd level, then 4th & so on.... upto 8th level....
so i want to show this in tree view, it could be horizontal or vertical.... bt i m nt getting hw to do it... so plz help me...
Thanks.
generate hierarchical tree view
Moderator: General Moderators
Re: generate hierarchical tree view
So the first level can have any number of users but after that only one per parent? Odd.
You can take the same approach to this as you would if it were a normal (any number of children per parent) tree.
This is the easiest form of HTML tree to build:
You can take the same approach to this as you would if it were a normal (any number of children per parent) tree.
This is the easiest form of HTML tree to build:
- Root
- A
- 1
- i
- 1
- B
- 2
- C
- 3
- iii
- 3
- D
- A
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London
Re: generate hierarchical tree view
Here's a pretty cool tree menu: http://www.dynamicdrive.com/dynamicinde ... /index.htm
Re: generate hierarchical tree view
Thanx tasairis to reply....
i want the same thing u hd drawan there....
& i m taking a numeric user_ids for all the user, & a username & both will be unique...
i want the same thing u hd drawan there....
& i m taking a numeric user_ids for all the user, & a username & both will be unique...
Re: generate hierarchical tree view
The HTML for such a structure looks like
<ul> starts a list, <li></li> marks an item, and </ul> ends the list.
Now,
Try to fill in the comments there.
Code: Select all
<ul>
<li>Item<ul>
<li>Sub item<ul>
<li>Sub sub item</li></ul></li>
<li>Next sub item</li></ul></li>
<li>Next item<ul>
<li>Sub next item</li></ul></li>
</ul>Now,
Code: Select all
function makeListForUser($user) {
echo "<ul>";
/* foreach list of sub users for $user as $subuser */ {
echo "<li>"; /* echo $subuser; */
makeListForUser(/* $subuser */);
echo "</li>";
}
echo "</ul>";
}
makeListForUser(/* root user */);