I am usning the treeview.com javascript menu for my navigation. I am dynamically creating a part of the menu using php from a directory structure. What I need help with is when it reads the directories, I need it to create subfolders for those directories. The way it now, it gives me the full directory path (Ex: Doctor Deliverable/Doctor Search, View/Use Cases). I need it to give me
Doctor Deliverable
Doctor Search, View
Use Cases
Below is the code for my menu:
<script>
// You can find instructions for this file here:
// http://www.treeview.net
// Decide if the names are links or just the icons
USETEXTLINKS = 1 //replace 0 with 1 for hyperlinks
// Decide if the tree is to start all open or just showing the root folders
STARTALLOPEN = 0 //replace 0 with 1 to show the whole tree
// Decide if the tree is to to be shown on a separate frame of its own
USEFRAMES = 0
// Remove the folder and link icons and keep only the +/- icons
USEICONS = 0
ICONPATH = "http://antioch.rss.riteaid.com/ra-apps/documentation/vorfa/js/"
// Make the folder and link labels wrap into multiple lines
WRAPTEXT = 0
// Folders reopen toprevious state across page loads
PERSERVESTATE = 1
foldersTree = gFld('', '')
f = foldersTree
insDoc(f,gLnk(0, '<b><font size=2>Welcome</font></b>', 'http://antioch.rss.riteaid.com/ra-apps/documentation/vorfa/'))
fSub = insFld(f,gFld('<b><font size=2>Documentation</font></b>', ''))
insDoc(fSub,gLnk(0, '<font size=2>CICS</font>', 'http://antioch.rss.riteaid.com/ra-apps/documentation/vorfa/cics_doc.php'))
insDoc(fSub,gLnk(0, '<font size=2>Job Aids</font>', 'http://antioch.rss.riteaid.com/ra-apps/documentation/vorfa/job_aids.php'))
insDoc(fSub,gLnk(0, '<font size=2>Program</font>', 'http://antioch.rss.riteaid.com/ra-apps/documentation/vorfa/program_doc.php'))
insDoc(fSub,gLnk(0, '<font size=2>Transaction</font>', 'http://antioch.rss.riteaid.com/ra-apps/documentation/vorfa/transaction_doc.php'))
fSub = insFld(f,gFld('<b><font size=2>Database</font></b>', ''))
insDoc(fSub,gLnk(0, '<font size=2>Data Model</font>', 'http://antioch.rss.riteaid.com/ra-apps/documentation/vorfa/data_model_db.php'))
insDoc(fSub,gLnk(0, '<font size=2>Data Dictionary</font>', 'http://antioch.rss.riteaid.com/ra-apps/documentation/vorfa/data_dictionary_db.php'))
fSub = insFld(f,gFld('<b><font size=2>Standard/Templates</font></b>', ''))
insDoc(fSub,gLnk(0, '<font size=2>Standards</font>', 'http://antioch.rss.riteaid.com/ra-apps/documentation/vorfa/standards.php'))
fSubSub = insFld(fSub,gFld('<b><font size=2>Prototypes</font></b>', ''))
insDoc(fSubSub,gLnk(0, '<font size=2>Visual Design</font>', 'http://antioch.rss.riteaid.com/ra-apps/documentation/vorfa/visual_design.php'))
insDoc(fSubSub,gLnk(0, '<font size=2>WireFrame</font>', 'http://antioch.rss.riteaid.com/ra-apps/documentation/vorfa/wireframe.php'))
fSub = insFld(f,gFld('<b><font size=2>Project Details</font></b>', ''))
fSubSub = insFld(fSub, gFld('<b><font size=2>Deliverables</font></b>', ''))
</script>
<?php
$root_directory="/ra-apps/documentation/vorfa/Deliverables";
$directory_command = "find ./ -type d | sed 's/^.\///'| grep -v 'CVS'| egrep -v '^$'";
$output=array();
exec($directory_command,$output);
$files=array();
$d_s=array();
$last_d="";
$first_time_thru=true;
foreach($output as $line) {
$file=basename($line);
$directory=dirname($line);
if ($directory != $last_d) {
// if this is the first time thru, turn flag off,
// else we need to add the previously generated
// arrays to our master list
if (!$first_time_thru) {
array_push($d_s,
array($last_d => $files));
$files=array();
}
}
array_push($files, $file);
$last_d=$directory;
$first_time_thru=false;
}
ksort($d_s);
foreach($d_s as $line) {
$directory=key($line);
$files=$line[$directory];
$_link_dir=$directory;
?>
<script>
fSubSubSub = insFld(fSubSub, gFld("<?php echo $directory; ?>", ""))
</script>
<?php
foreach($files as $file) {
?>
<script>
insDoc(fSubSubSub, gLnk(0, "<?php echo $file;?>", "<?php echo "$directory/$file"; ?>"))
</script>
<?php
}
}
?>
<script>
fSubSub = insFld(fSub,gFld('<b><font size=2>Use Cases</font></b>', ''))
insDoc(fSubSub,gLnk(0, '<font size=2>Phase 1</font>', 'http://antioch.rss.riteaid.com/ra-apps/documentation/vorfa/use_cases.php'))
insDoc(fSubSub,gLnk(0, '<font size=2>Phase 2</font>', 'http://antioch.rss.riteaid.com/ra-apps/documentation/vorfa/use_cases_phase2.php'))
insDoc(fSubSub,gLnk(0, '<font size=2>QA Test Plans</font>', 'http://antioch.rss.riteaid.com/ra-apps/documentation/vorfa/use_cases_qa.php'))
insDoc(fSub,gLnk(0, '<font size=2>Constructions</font>', 'http://antioch.rss.riteaid.com/ra-apps/documentation/vorfa/constructions.php'))
insDoc(f,gLnk(0, '<b><font size=2>Project Implementation</font></b>', 'http://antioch.rss.riteaid.com/ra-apps/documentation/vorfa/proj_implementation.php'))
insDoc(f,gLnk(0, '<b><font size=2>Meeting Minutes</font></b>', 'http://antioch.rss.riteaid.com/ra-apps/documentation/vorfa/meeting_minutes.php'))
insDoc(f,gLnk(0, '<b><font size=2>Evaluations</font></b>', 'http://antioch.rss.riteaid.com/ra-apps/documentation/vorfa/evaluations.php'))
fSub = insFld(f,gFld('<b><font size=2>AutoRX Documentation</font></b>', ''))
insDoc(fSub,gLnk(0, '<font size=2>Program</font>', 'http://antioch.rss.riteaid.com/ra-apps/documentation/vorfa/autorx_program.php'))
insDoc(fSub,gLnk(0, '<font size=2>Transaction</font>', 'http://antioch.rss.riteaid.com/ra-apps/documentation/vorfa/autorx_transaction.php'))
</script>
Thanks!!