06-23-2008, 02:54 AM
|
#2 (permalink)
|
|
The Acquainted
Join Date: May 2008
Location: Québec
Posts: 104
Thanks: 10
|
Resolved thamks !
[php]
function dirlist($dir, $startDepth = 0)
{
static $depth;
$spaceMulti = 4;
$depth = empty($depth) ? $startDepth : $depth;
$dh = opendir($dir);
$isLeaf = false;
$depth++;
while (false !== ($file = @readdir($dh)))
{
if ($file == '.' || $file == '..')
{
continue;
}
$dirPath = $dir . '/' . $file;
$aHasDirs = array();
$aHasDirs = glob(realpath($dir . '/' . $file) . '/*', GLOB_ONLYDIR);
if (count($aHasDirs) > 0)
{
$class = 'fly';
$isLeaf = false;
}
else
{
$class = '';
$isLeaf = true;
}
if (is_dir($dirPath))
{
echo "\n" . str_repeat(' ', $spaceMulti * $depth) .
'<li><a href="http://test.comtest_images.php?folder=' . $dirPath . '" class="' . $class . '">' . $file . '</a>';
if (!$isLeaf)
{
$depth++;
echo "\n" . str_repeat(' ', $spaceMulti * $depth) . "<ul>";
dirlist($dirPath);
echo "\n" . str_repeat(' ', $spaceMulti * $depth) . "</ul>\r";
$depth--;
echo "\n" . str_repeat(' ', $spaceMulti * $depth) . "</li>\r";
}
else
{
echo "</li>\r";
dirlist($dirPath);
}
}
}
fclose($dh);
$depth--;
}
dirlist ("Pictures/Category/Pic-S", 0);
[\php]
__________________
That's why we are not alone on earth... let's build !
|
|
|
|