View Single Post
Old 10-06-2009, 09:09 AM   PM User | #13
joelbrock
New to the CF scene

 
Join Date: Oct 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
joelbrock is an unknown quantity at this point
The getDirectory function is totally awesome! and exactly what i needed. here's the thing tho: when i was hacking it up on my dev box it was working great. but then, once i got it the way i wanted it, i uploaded the files to the web server, and now everything is coming up in random order.

is there a way to force it to read alphabetically? Is is my web server? is it something else entirely? anybody know of this issue?

TIA
~joel

Here's my code:
PHP Code:
function getDirectory$path '.'$level ){

    
$ignore = array( 'cgi-bin''.''..' );

    
$dh = @opendir$path );
    
    while( 
false !== ( $file readdir$dh ) ) ){
    
        if( !
in_array$file$ignore ) ){
            
            if( 
is_dir"$path/$file" ) ){
                
$dir $path $file;
                
                echo 
"<div class=\"highslide-gallery\">\n
                    <center>
                    <a id=\"gallery-opener\" href=\"javascript:;\" onclick=\"document.getElementById('thumb$level').onclick()\">$file</a>\n
                    </center>
                    <div class=\"hidden-container\">\n"
;
                    
                
$dh1 = @opendir$dir );

                while( 
false !== ( $image readdir$dh1 ) ) ){
                    if( !
in_array$image$ignore ) ){
                        if( !
is_dir"$dir/$image" ) ){
                            echo 
"<a id=\"thumb$level\" class='highslide' href='$dir/$image' title=\"\" onclick=\"return hs.expand(this, config$level)\">$image</a>\n";
                        }
                    }
                }
                echo 
"</div>\n</div>\n\n";
                
$level++;
            }
        }
    }
    
closedir$dh );
}

getDirectory('images/'); 
joelbrock is offline   Reply With Quote