Not signed in (Sign In)

Vanilla 1.1.9 is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthorropehawn
    • CommentTimeJan 9th 2010
     
    How can i assure that the images will display in a specific order i have named them (01A, 01B, 02A, 02B, 02C.......) and they are not displaying in that order.

    http://dev.vanessanoel.com/_pages/hotelpress.html

    thank you
    • CommentAuthorcademan
    • CommentTimeJan 10th 2010 edited
     
    Hey ropehawn,

    Open gallery.php file and replace this code

    -------------- code starts ---------------
    while( false !== ( $file = readdir( $dh ) ) ){
    // Loop through the directory
    if( !in_array( $file, $ignore ) ){
    // Check that this file is not to be ignored
    // get images
    if( !is_dir( "$path/_thumbs/$file" ) ){
    //print out xml
    echo '' . chr(13);
    }
    }
    }

    closedir( $dh );
    // Close the directory handle
    ----------------- code ends -------------------

    with this code

    ---------------code starts ----------------
    //array for sorting
    $narray=array();
    $i = 0;

    while( false !== ( $file = readdir( $dh ) ) ){
    // Loop through the directory
    if( !in_array( $file, $ignore ) ){
    // Check that this file is not to be ignored
    // get images
    if( !is_dir( "$path/_thumbs/$file" ) ){
    $narray[$i]=$file;
    $i++;
    }
    }
    }

    // Close the directory handle
    closedir( $dh );

    //sort files
    sort($narray);

    for($i=0; $i //print out xml
    echo '' . chr(13);
    }
    --------------- code ends ---------------

    I didn't test this, but let me know if it works for you. This should work, but if you have troubles I will do some testing and send you a edited gallery.php file that will work.
    • CommentAuthorropehawn
    • CommentTimeJan 11th 2010
     
    Worked perfectly. Thank you!
    • CommentAuthorsifuel
    • CommentTimeMar 8th 2010
     
    Sorry to "hijack" your thread but i would be ever grateful if it would sort my sites gallery according its creation date..