any reason not to add a "sort()" call in create_file_dropdown()?
Posted: Tue Oct 12, 2010 12:12 am
Howdy. I have just started adding some {content_image} boxes in my templates and noticed that there is no sorting being done for filename lists. Since that tends to make it harder to find what you are looking for (in larger lists especially), I was curious if anyone can think of a reason NOT to add a "sort()" call to this function?
It looks safe to me as it does not appear to expect any specific array index association but thought I would ask in case I am not seeing something.
Cheers
Code: Select all
function create_file_dropdown($name,$dir,$value,$allowed_extensions,$optprefix='',$allownone=false,$extratext='',
$fileprefix='',$excludefiles=1)
{
$files = array();
$files = get_matching_files($dir,$allowed_extensions,true,true,$fileprefix,$excludefiles);
if( $files === false ) return false;
sort($files); // make filelist easier to read
$fileprefix='',$excludefiles=1)
...
Cheers