Advertisement

Dynamically loading a static folder list

Moderators: Calcifer, slothy

Dynamically loading a static folder list

Postby vadar36 » Thu Nov 15, 2007 3:58 pm

just started playing with this script and love it but cant get it to do what i want.

I have a table full of items which i want to add dynamically. I know im being dumb but i just cant get this to work.

---------------code--------------
$tree->addToArray(1,"*******",0,"");
$tree->addToArray(2,"*******",1,"");
$tree->addToArray(3,"*******",1,"");
$tree->addToArray(4,"********",1,"");
$tree->addToArray(5,"*****",1,"");
$tree->addToArray(6,"********",1,"");
$tree->addToArray(7,"*******",1,"");
$tree->addToArray(8,"*******",1,"");
$tree->addToArray(9,"********",1,"");
$tree->addToArray(10,"********",9,"");

do {
if ($row_tree['type'] = 'tools'){
$tree->addToArray(($row_tree['id']+10),"".$row_tree['artno']."",8,"#","frmMain","img/dhtmlgoodies_sheet.gif");
}else{
$tree->addToArray(($row_tree['id']+10),"".$row_tree['artno']."",10,"#","frmMain","img/dhtmlgoodies_sheet.gif");
};
} while ($row_tree = mysql_fetch_assoc($tree));

$tree->writeCSS();
$tree->writeJavascript();
$tree->drawTree();
---------------------end--------------

Basically i get 1 entry and then it dies. any help would be really appreciated.
vadar36
 
Posts: 1
Joined: Thu Nov 15, 2007 3:54 pm

Postby ybuskila » Thu Feb 14, 2008 11:22 am

why do you add + 10 to the id ?
why do you write 8, 10 in parentid filed ?

you should have id, parentId from the database and then you put them in the addToArray function as they come from the database, the script recognize the parent and it's sons by himself
ybuskila
 
Posts: 4
Joined: Sun Jan 13, 2008 5:13 pm


Return to Folder tree questions

Who is online

Users browsing this forum: No registered users and 10 guests