function directoryToList($dir, $onlydirs = false, $sub = false) { $levels = explode('/', $dir); $subtab = count($levels) > 2 ? count($levels) - 2 : 0; $t = count($levels) + ($sub !== false ? 1 + $subtab : 0); $output = entab($t) . '<ul id="parent_' . ereg_replace('/', ':', $dir) . '">'; $dirlist = opendir($dir); while ($file = readdir($dirlist)) { if ($file != '.' && $file != '..' && $file != 'index.php' && !eregi('~', $file) && !eregi('.php', $file)) { $newpath = $dir . '/' . $file; $level = explode('/', $newpath); $tabs = count($level) + ($sub !== false ? 1 + $subtab : 0); $link = ereg_replace('.php', '', ereg_replace('views/', '', $newpath)); $class = is_dir($newpath) ? ' class="parent"' : ' class="file"'; $output .= $onlydirs == true && is_dir($newpath) || $onlydirs == false ? entab($tabs) . '<li id="' . $file . '"' . $class . '><a href="?' . (is_dir($newpath) ? $link . '/index' : $link) . '">' . prettify($file) . '</a>' . (is_dir($newpath) ? directoryToList($newpath, $onlydirs, false) . entab($tabs) : '') . '</li>' : ''; } } closedir($dirlist); $output .= entab($t) . '</ul>'; //if($onlydirs == TRUE) $output = preg_replace('/<ul(.*)>\\n([\\t]+)<\\/ul>/', '', $output); return $output; }
" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="javascript/prototype.js"></script> <script type="text/javascript" src="javascript/Frame.js"></script> </head> <body id="body" onload="Frame.init();"> <div id="working"></div> <div id="container"> <div id="navigation"> <h3>Navigation</h3> <?php echo directoryToList('views'); ?> </div> <div id="header"> <h1 id="title"><?php echo $site->title; ?> </h1> <h2 id="subtitle"><?php echo $site->subtitle; ?> </h2> <p id="summary"><?php echo $site->summary; ?>