Jump to content

Determine if this folder is the last level within that folder?


Peuplarchie

Recommended Posts

Good day,

          I'm working on a script and this script list folder in a html list.

 

Here is the code;

 


<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>

 

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 !

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.