[eluser]Unknown[/eluser]
Hi my server filesystem does not sort files alphabetically - so my image list for my newsletter cms made in code igniter shows the images unordered. I've tried all sorts of sort code for the $filedata and nothing has worked - does anybody have any idea how to adjust this so my files are sorted properly? It's a big pain to have to scroll through the unordered list to select images!
I think the culprit is in the file /system/helpers/directory_helper.php
Code:
function directory_map($source_dir, $top_level_only = FALSE)
{
if ($fp = @opendir($source_dir))
{
$filedata = array();
while (FALSE !== ($file = readdir($fp)))
{
if (@is_dir($source_dir.$file) && substr($file, 0, 1) != '.' AND $top_level_only == FALSE)
{
$temp_array = array();
$temp_array = directory_map($source_dir.$file."/");
$filedata[$file] = $temp_array;
}
elseif (substr($file, 0, 1) != ".")
{
$filedata[] = $file;
}
}
return $filedata;
}
}