*EDIT
Please see the bottom for simpler question on function array...
I'm trying to use dtree with php....
see: http://www.destroydrop.com
This is a free js...
I'm don't know if I'm tired or what but I'm racking my brain trying to figure this out...
Basically dtree is like a js windows explorer menu for your web site... I want to allow users to add, modify and delete folders...
Storing the "Folder Path/File Path", "Name", etc.. in mysql...
I'd also like for them to be able to move the folder/files to a different path (change its order)...
This is an example of the output I need:
d.add(1,0,'Node 1','http://mydomain.com','Node 1','_parent','images/folder.gif');
1 is the id
0 is the parent id
Here's a better example:
d.add(1,0,'Node 1','http://mydomain.com','Node 1','parent','images/folder.gif');
d.add(2,0,'Node 2','http://mydomain.com','Node 2','parent','images/folder.gif');
d.add(3,2,'Node 3','http://mydomain.com','Node 3','parent','images/folder.gif');
d.add(4,2,'Node 4','http://mydomain.com','Node 4','parent','images/folder.gif');
d.add(5,0,'Node 5','http://mydomain.com','Node 5','parent','images/folder.gif');
d.add(6,5,'Node 6','http://mydomain.com','Node 6','parent','images/folder.gif');
d.add(7,5,'Node 7','http://mydomain.com','Node 7','_parent','images/folder.gif');
so for the above examples I think I would need to store the path for how they are built.... The above examples would have a path like this:
/home/Node 1/
/home/Node 2/
/home/Node 2/Node 3/
/home/Node 2/Node 4/
/home/Node 5/
/home/Node 5/Node 6/
/home/Node 5/Node 7/
This way the user could change the position of the path...
So I need to find a way to maybe write a function that would give an $id and a $parent_id on output...
I'm open to any suggestions here...
[edit]
ok since there are no suggestions yet, how about this...
/home/Node 1/
/home/Node 2/
/home/Node 2/Node 3/
/home/Node 2/Node 4/
/home/Node 5/
/home/Node 5/Node 6/
/home/Node 5/Node 7/
How can I echo back from the arrays above...
(which are stored in mysql)
Each gets a id and a parent id...
So
echo $i.$pid;
How do I assign both Node 3 and Node 4 to the parent Node 2 (pid = 2)?
And then moving on How do I assign Node 6 and Node 7 to Node 5 (pid = 5);
I would think there is a function that could do this quickly....