Search This Blog

Tuesday, August 16, 2011

sorting problem

Hi,


Can someone please help me out for the sorting problem for this php script? Because there is no an ability for sorting directories or files?


Any responses will be greatly appreciated it.



PHP Code:








$path�=�"docs/";


����function�createDir($path�=�'.')


����{����


��������if�(
$handle�=�opendir($path))�


��������{


������������echo�
"

    ";


    ��������


    ������������while�(
    false�!==�($file�=�readdir($handle)))�


    ������������{


    ����������������if�(
    is_dir($path.$file)�&&�$file�!=�'.'�&&�$file�!='..')


    ��������������������
    printSubDir($file,�$path,�$queue);


    ����������������else�if�(
    $file�!=�'.'�&&�$file�!='..')


    ��������������������
    $queue[]�=�$file;


    ������������}


    ������������


    ������������
    printQueue($queue,�$path);


    ������������echo�
    "
"
;


��������}


����}


����


����function�
printQueue($queue,�$path)


����{


��������foreach�(
$queue�as�$file)�


��������{


������������
printFile($file,�$path);


��������}�


����}


����


����function�
printFile($file,�$path)


����{


��������echo�
"
  • .$path.$file.""�target="_blank�">$file


  • "
    ;


    ����}


    ����


    ����function�
    printSubDir($dir,�$path)


    ����{


    ��������echo�
    "
  • $dir";


    ��������
    createDir($path.$dir."/");


    ��������echo�
    "
  • "
    ;


    ����}


    ����


    ����
    createDir($path);�













    http://bit.ly/o4frT4

    No comments:

    Post a Comment