...

View Full Version : Adding ability to sort by file extension..



Errica
07-24-2008, 09:51 PM
Here's the code with the array:


if ($open = @opendir($home_directory.$path))
{
for($i=0;($file = readdir($open)) != FALSE;$i++)
if (is_file($home_directory.$path.$file) && !is_hidden_file($home_directory.$path.$file))
{
$icon = get_icon($file);
$filesize = filesize($home_directory.$path.$file);
$permissions = decoct(fileperms($home_directory.$path.$file)%01000);
$modified = filemtime($home_directory.$path.$file);
$extension = "";
$files[$i] = array(
"icon" => $icon,
"filename" => $file,
"filesize" => $filesize,
"permissions" => $permissions,
"modified" => $modified,
"extension" => $extension,
);
}
closedir($open);

if (isset($files))
{
usort($files, "compare_filedata");
reset($files);
}
}

How can I add functionality to sort by file extension?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum