enigma1

msg:4413002 | 9:09 am on Feb 1, 2012 (gmt 0) |
Use the an array to get the filenames first $files_array = array(); while( ($files_array[] = readdir($dir)) !== false ); array_pop($files_array); sort($files_array, SORT_STRING); foreach($files_array as file) { if($_SETTINGS['FILE_LIST']){ ...... or you can do the sorting after you performed filtering and before display it and would be better. And get rid of the ereg depreciated functions.
|
chrissim

msg:4413005 | 9:32 am on Feb 1, 2012 (gmt 0) |
hi, im getting error here maybe i didn't get it right. Parse error: syntax error, unexpected ')', expecting T_PAAMAYIM_NEKUDOTAYIM
|
enigma1

msg:4413023 | 10:44 am on Feb 1, 2012 (gmt 0) |
You can post the whole code again you use with the mods, at least the part I posted was tested.
|
chrissim

msg:4413847 | 10:53 am on Feb 3, 2012 (gmt 0) |
hi guys, Here is my complete script and i just can't figured out what went wrong and unable to get the dir sorting order. Maybe if you can show me the correct part where it should go. Thanks <? if (is_dir($_SETTINGS['DIR'])) { $dir = opendir("{$_SETTINGS['DIR']}"); echo "<table width=\"100%\" valign=\"top\" border=\"0\" cellspacing=\"1\" cellpadding=\"1\"> <tr> <td valign=\"top\"><b>File List Of</b> {$_SETTINGS['DIR']}/"; echo "<select name=\"edit_file_name\"> <option value=\"$file\">$file</option> <option value=\"\"></option>"; while ($file = readdir ($dir)) { if($_SETTINGS['FILE_LIST']){ $file2 = array_pop(explode(".",$file)); if(!in_array($file2,$_SETTINGS['FILE_LIST'])) continue; } if ($file != "." && $file != ".." && !is_dir($file) && !eregi("\.bac", $file)){ print '<option value="'.$file.'">'.$file. '</option>'; } // echo " <a href=\"$_SERVER[PHP_SELF]?edit_file_name=$file\">$file</a></td> \n"; } echo '</select> '; closedir($dir); } else echo "{$_SETTINGS['DIR']} not found"; ?> |
|
|
enigma1

msg:4413855 | 11:36 am on Feb 3, 2012 (gmt 0) |
Change this line: while ($file = readdir ($dir)) { with this: $files_array = array(); while( ($files_array[] = readdir($dir)) !== false ); array_pop($files_array); sort($files_array, SORT_STRING); foreach($files_array as file) { |
| and see if it works
|
chrissim

msg:4413859 | 11:59 am on Feb 3, 2012 (gmt 0) |
hi enigma1, i changed it but it don't worked Parse error: syntax error, unexpected ')', expecting T_PAAMAYIM_NEKUDOTAYIM in /home/#*$!x/public_html/#*$!xx.com
|
enigma1

msg:4413865 | 12:15 pm on Feb 3, 2012 (gmt 0) |
oops sorry it should be $file. change this: foreach($files_array as file) { with this: foreach($files_array as $file) {
|
chrissim

msg:4413867 | 12:40 pm on Feb 3, 2012 (gmt 0) |
Great worked like a champ man Thanks Egnima1 :)
|
|