So, ich habe jetzt eine Lösung. Wer will?
<script language="JavaScript" type="text/javascript">
function extract_path(curPath,newPath) {
if (newPath=="..") {
curPath = curPath.substr(0,curPath.length-1); // letztes / weg
newPath = curPath.substr(0,curPath.lastIndexOf("/")+1);
} else {
newPath = curPath+newPath;
}
window.location.href = "sitzplan.php?curordner="+newPath;
}
</script>
<?php
function show_dir($dir) {
$handle = @opendir($dir);
echo "<div id="divnav" style="left:10px">";
echo "<ul id="ulnav">";
while ($file = @readdir ($handle)) {
if(is_dir($dir.$file) && $file!=".") {
if ($file=="..") {
if (ereg ("[a-z]|[0-9]", $dir))
echo "<li class="linav" onclick="extract_path('$dir','..')"> $file </li>";
} else {
echo "<li class="linav" onclick="extract_path('$dir','$file'+'/')"> $file </li>";
}
} elseif ($file!=".") {
echo "<li class="linav"> $file </li>";
}
}
echo "</ul>";
echo "</div>";
@closedir($handle);
}
function build_starting_path() {
$pie=explode("/","$_SERVER[PHP_SELF]"); //Anzahl der Verzeichnisse
$trenner="/"; // Alternativ: ':', '/'
$b=count($pie);
$ta = "";
$resString = ""; // Alternativ: 'Home', 'Start'
for($a=0;$a<$b-3;$a++){
$resString .= "../";
}
for($a=2;$a<$b-1;$a++){
$resString .= $pie[$a]."/";
}
return $resString;
}
if (isset($_GET['curordner']) && $_GET['curordner']!="") {
show_dir($_GET['curordner']);
echo "<input type="hidden" value="$_GET[curordner]" id="curPath" >";
}
else {
$startPath = build_starting_path();
show_dir("$startPath");
echo "<input type="hidden" value="$startPath" id="curPath" >";
}
?>
CSS-DATEI
ul#ulnav{
margin:0;
padding:0;
}
ul#ulnav li{
list-style: none;
display:block;
}
ul#ulnav li:hover{
cursor:pointer;
background-color:#444444;
color:#fefefe;
}
div#divnav {
position:absolute;
left:-2000px;
padding:1em;
margin:0;
background-color:#dfdfdf;
}