Ok here is my code…
<?php
function addDirectory($level, $path, $name, $mod_time,$subNodes)
{
$node = '
<directory directory="true" level="'.$level.'" path="'.$path.'" label="'.$name.'" modTime="'.$mod_time.'">'.$subNodes.'</directory>';
return $node;
}
function addFile($level, $path, $name, $mod_time)
{
$node = '
<file directory="false" level="'.$level.'" path="'.$path.'" label="'.$name.'" modTime="'.$mod_time.'"></file>';
return $node;
}
function recur_dir($dir)
{
$dirlist = opendir($dir);
while ($file = readdir ($dirlist))
{
if ($file != '.' && $file != '..')
{
$newpath = $dir.'/'.$file;
$level = explode('/',$newpath);
if (is_dir($newpath))
{
$index .= addDirectory(count($level)-1,$newpath,end($level),filemtime($newpath),recur_dir($newpath));
//$index .= recur_dir($newpath);
}else{
$index .= addFile(count($level)-1,$newpath,end($level),filemtime($newpath));
}
}
}
closedir($dirlist);
return $index;
}
$index = '<root label="Root of Site">'.recur_dir('..').'</root>';
// you only see the string when you look at the source in your browser ...
echo $index;
?>
what this code does is returns a XML type string that is passed back to Flash and used to populate the XML tree in MX2004…any how what this does is just put the elements in the document as it reaches them…but what I would like for it to do is to put all the directories at the top and then the rest of the files after the directories…does that make sense