javascript1.php函数部分:
function showtree($treeName,$type,$path,$id)
{
global $get_view;
if ($id=="1") $isshare="share";
else $isshare="private";
// $treeName="d".time().rand(0009,9999);
$str="<div class='dtree'><script type='text/javascript'> $treeName = new dTree('$treeName'); $treeName.add($id,-1,'<span class=rootnode>".$type." </span>','main.php?fold=".$id."&share=".$isshare."&view=".$get_view."');\n";
$filename=$path;
if($FD_BOXLIST = fopen($filename,"r"))
{
$cardRow= array();
while ($buffer = fgets($FD_BOXLIST, 2048))
{
$buffer = chop($buffer); //
if( trim($buffer)!="")
{
$settings=split(",",$buffer);
$cardRow[]= array(
'ID' => $settings[0],
'NAME' => $settings[1],
'PARENTID' => $settings[2],
'PATH' => $settings[3],
'SHARE' => $settings[4],
'TAG'=> $settings[5],
'EXTANTION' => $settings[6]
);
if ($settings[6]=="fl")
$str.="$treeName.add(".$settings[0].",".$settings[2].",'".$settings[1] ."','main.php?fold=".$settings[0]."&share=".$isshare."&view=".$get_view."','','','images/".$settings[6].".gif');\n";
}//end if
if(feof($FD_BOXLIST)) break;
}//end while
fclose($FD_BOXLIST);
}
$str.="document.write($treeName); </script> </div> ";
echo $str;
}
2.html部分:
<link rel="StyleSheet" href="css/dtree.css" type="text/css" />
<script type="text/javascript" src="include/dtree.js"></script>
<div id="ifolder">
<tr>
<td colspan="2"><? showtree("Private","Private folder",$txt_path,0); ?></td>
</tr>
</div>