Page 1 of 1

Dynamically loading a static folder list

PostPosted: Thu Nov 15, 2007 3:58 pm
by vadar36
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.

PostPosted: Thu Feb 14, 2008 11:22 am
by ybuskila
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