function directoryToArray($directory, $extension="", $full_path = true) {
$array_items = array();
if ($handle = opendir($directory)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
if (is_dir($directory. "/" . $file)) {
echo "<b>". $file."</b><ul>";
$array_items = array_merge($array_items, directoryToArray($directory. "/" . $file, $extension, $full_path));
}
else {
if(!$extension || (ereg("." . $extension, $file)))
{
if($full_path) {
$array_items[] = $directory . "/" . $file;
echo "<li>". $file."</li>";
}
else {
$array_items[] = $file;
}
echo "</ul>";
}
}
}
}
closedir($handle);
}
return $array_items;
}
//modify the following for your path as needed
directoryToArray("../../");
Category Forum
Panels and InfusionsLabels
None yet
Statistics
1 participant
Notifications
You are not receiving notifications from this thread.
Related Questions