Determine if this folder is the last level within that folde
Posted: Sun Feb 28, 2010 9:41 pm
Good day,
I'm working on a script and this script list folder in a html list.
Here is the code;
example folder
|
- Folder 1
- Folder 2
|
- Folder2.1
|
- Folder3
The deal here is that I could go by CSS level of list but my problem is that sometime there is more subfolder yhat this example.
Is there a way that I can tell the last level folder to be written in bold ?
Thanks !
I'm working on a script and this script list folder in a html list.
Here is the code;
Code: Select all
<html>
<head>
<style type="text/css">
ul {
list-style-image: url(Icons/box_icon.png);
}
li li {
list-style-image: url('Icons/open_book_icon.jpg');
}
li li li {
list-style-image: url('Icons/gallery.gif');
}
</style>
</head>
<body>
<?PHP
function globDir($dir)
{
$files = glob("$dir/*", GLOB_ONLYDIR);
if(!empty($files))
{
echo "<ul>\n";
foreach($files as $file)
{
echo "<li>";
echo "<b>". basename($file)."</b>\n";
globDir($file);
echo "</li>\n";
}
echo "</ul>\n";
}
}
globDir('Photos');
?>
</body>
</html>
|
- Folder 1
- Folder 2
|
- Folder2.1
|
- Folder3
The deal here is that I could go by CSS level of list but my problem is that sometime there is more subfolder yhat this example.
Is there a way that I can tell the last level folder to be written in bold ?
Thanks !