This commit is contained in:
Fred Tempez 2024-03-14 15:46:31 +01:00
parent f86f38d8b0
commit 5846c111fe
2 changed files with 40 additions and 35 deletions

View File

@ -81,7 +81,7 @@ private function getFolderContent($chemin)
if (is_dir($chemin)) {
// Ouvrir le dossier
if ($dh = opendir($chemin)) {
$items = isset($items) ? $items . '<ul class="folder">' : '<ul class ="folder">';
$items = isset($items) ? $items : '<ul>';
// Parcourir les éléments du dossier
while (($element = readdir($dh)) !== false) {
// Exclure les éléments spéciaux
@ -92,10 +92,10 @@ private function getFolderContent($chemin)
// Vérifier si c'est un dossier
if (is_dir($cheminComplet)) {
// Afficher le nom du dossier avec un élément details
$items .= "<li class='directory'>$element<ul>";
$items .= "<li class='directory'>$element";
// Appeler récursivement la fonction pour ce sous-dossier
$items .= $this->getFolderContent($cheminComplet);
$items .= '</ul></li>';
$items .= '</li>';
} else {
// Afficher le nom du fichier comme un lien
$items .= "<li class='file'><a href='$cheminComplet' target='_blank'>$element</a></li>";

View File

@ -1,40 +1,45 @@
#dirindex article {
display: block;
margin: 0 auto;
width: 480px;
}
#dirindex article{
display: block;
margin: 0 auto;
width: 480px;
}
#dirindex a {
color: #004466;
text-decoration: none;
}
#dirindex a {
color: #004466;
text-decoration: none;
}
#dirindex a:hover {
text-decoration: underline;
}
#dirindex a:visited {
color: #666666;
}
#dirindex a:hover {
text-decoration: underline;
}
#dirindex details summary, #dirindex details summary::-webkit-details-marker {
list-style: none;
cursor: pointer;
}
#dirindex a:visited {
color: #666666;
}
#dirindex {
list-style: none;
}
#dirindex .directory {
list-style-type: "\1F4C1";
}
#dirindex details summary,
#dirindex details summary::-webkit-details-marker {
list-style: none;
cursor: pointer;
}
#dirindex .file {
list-style-type: "\1F4C4";
}
#dirindex {
list-style: none;
}
#dirindex ul li {
margin-top: 5px;
}
#dirindex .directory {
list-style-type: "\1F4C1";
}
#dirindex .file {
list-style-type: "\1F4C4";
}
#dirindex ul li {
margin-top: 10px;
}
#dirindex li {
padding-left: 5px;
list-style-position : outside;
}