I'm currently working on a little side menu that is created dynamically using php-treemenu. which can be found here
http://www.zinc.f2s.com/scriptorium/index.php/treemenu
but the problem I run into is, after the 1st menu item it duplicates on all after that.
for example. the ouput file that it uses to create the menues with look something like this
.About the Articles|/Articles//About_the_Articles.php
.Advances in Therapy
..Appendix A|/Articles/Advances_in_Therapy/Appendix_A.php
..Appendix B|/Articles/Advances_in_Therapy/Appendix_B.php
.Contemporary
..Appendix A|/Articles/Contemporary/Appendix_A.php
..Appendix B|/Articles/Contemporary/Appendix_B.php
..Appendix A|/Articles/Contemporary/Appendix_A.php
..Appendix B|/Articles/Contemporary/Appendix_B.php
..Appendix C|/Articles/Contemporary/Appendix_C.php
.International
..Appendix A|/Articles/International/Appendix_A.php
..Appendix B|/Articles/International/Appendix_B.php
..Appendix A|/Articles/International/Appendix_A.php
..Appendix B|/Articles/International/Appendix_B.php
..Appendix C|/Articles/International/Appendix_C.php
..Appendix A|/Articles/International/Appendix_A.php
..Appendix B|/Articles/International/Appendix_B.php
..Chart|/Articles/International/Chart.gif
..Chart Usage|/Articles/International/Chart_Usage.gif
..Chart Scores|/Articles/International/Chart_Scores.gif
.Yea|/Articles//Yea.php
as you can see, after the 1st one.. its all of the ones in front of it plus the new ones from the folder. Once I figured out my Loop problem I was going to re do it a little bit so it could go down as many folders and files as needed, not just 1 folder deep with files, but I couldn't figure this loop out.
listed below is my code
$treefile = "demomenu.tmp";
$list = array(".php",".mov",".html",".htm",".JPG",".jpg",".GIF",".gif");
$pmenu="Articles";
$fp = fopen ("demomenu.tmp", "w");
exec("/bin/ls /home/httpd/html/$pmenu/$smenu/",$r);
for ($i=0;$i < count($r);$i++){
$dir = strstr ($r[$i], '.');
if(strlen($dir) < 1){
$smenu = $r[$i];
$name[$i] = ".".$r[$i]."\n";
$name[$i] = str_replace(""," ",$name[$i]);
fwrite($fp, $name[$i]);
exec("/bin/ls /home/httpd/html/$pmenu/$smenu/",$q);
for ($e=0;$e < count($q);$e++){
$fil = strstr ($q[$e], '.');
if(strlen($fil) > 1){
$name[$e] = "..".$q[$e];
$name[$e] = str_replace(""," ",$name[$e]);
for ($spacer=0;$spacer < count($list);$spacer++){
$name[$e] = str_replace("$list[$spacer]","",$name[$e]);
}
fwrite($fp, $name[$e]);
$name[$e] = str_replace("..","",$q[$e]);
$name[$e] = "|"."/$pmenu/$smenu/".$q[$e]."\n";
fwrite($fp, $name[$e]);
}
}
} else {
$smenu = "";
$name[$i] = ".".$r[$i];
$name[$i] = str_replace("_"," ",$name[$i]);
for ($spacer=0;$spacer < count($list);$spacer++){
$name[$i] = str_replace("$list[$spacer]","",$name[$i]);
}
fwrite($fp, $name[$i]);
$name[$i] = str_replace(".","",$r[$i]);
$name[$i] = "|"."/$pmenu/$smenu/".$r[$i]."\n";
fwrite($fp, $name[$i]);
}
}
fclose ($fp);
require "treemenu.inc";