Not signed in (Sign In)

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

    • CommentAuthorFaken
    • CommentTimeNov 7th 2005
     
    Well I dug around on the forums and I just can't find it :( Is there a way to sort the Collections view in alphabetical order by default rather than by ID or creation date?

    Thanks,
    Dan
    • CommentAuthorddejong
    • CommentTimeNov 7th 2005
     
    Gallery.php, line ~542:
    $sql = "SELECT * FROM `".$TABLE_PREFIX."collections` WHERE id IN ($imlist) LIMIT ".$from.",".$config["thumb_num"];

    Change to SOMETHING like below:
    $sql = "SELECT * FROM `".$TABLE_PREFIX."collections` WHERE id IN ($imlist) LIMIT ".$from.",".$config["thumb_num"] . " ORDER by 'name'";

    Don't know if it'll work, it depends on whether (1) that's the sql actually determining the order of the collections, (2) the SQL syntax and whether I'm putting it in the right place. I'm certain, but it's worth a shot. Mike and Anti would have a better idea. I've actually mutilated my collections view, so I can't test myself.

    Best of luck,
    Derek
    • CommentAuthorjack
    • CommentTimeNov 9th 2005
     
    I was looking for a way to sort the albums and collections in alphabetical order too, but THEY ;) must have changed something because I can't find those line you're referring to. Any idea where they went?
    • CommentAuthorkanjigirl
    • CommentTimeNov 10th 2005
     
    Try this (this is for albums, but you can use the same technique for collections):

    $sql = "SELECT * FROM `".$TABLE_PREFIX."albums` WHERE `parent_id` = '$id' AND id IN ($imlist) ORDER BY `name` DESC LIMIT

    change DESC to ASC (descending to ascending order)

    Debbie
    • CommentAuthorjack
    • CommentTimeNov 10th 2005
     
    The lines/functions have been moved in the nighlies to the plog-functions.php file. That's why I couldn't find it. But thanks, it works ok now :).
    • CommentAuthorFaken
    • CommentTimeNov 11th 2005
     
    Hi all,

    ddejong - I found the line but that edit doesn't seem to work... I get the following error on the main page of the gallery:

    "You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '20ORDER by 'name'' at line 1

    SELECT * FROM `plogger_collections` WHERE id IN (-1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,33,34,35,36,37,38,39,40,41) LIMIT 0,20ORDER by 'name'"

    kanjigirl - That sorts the albums out alright, but I want to sort the collections by alphabetical order rather than the order in which they were created, which is what it seems to be doing.

    Thanks again,
    Dan
    •  
      CommentAuthormike
    • CommentTimeNov 12th 2005
     
    Looks like there should be a space between 0,20 and ORDER. Check your query string generator and make sure there is a space before ORDER or after the number inserted after LIMIT
    • CommentAuthorFaken
    • CommentTimeNov 12th 2005
     
    I dunno what's going on... I am using the exact line ddejong gave me and as soon as I use that line, I get this error :/ Everything seems to be ok. Here's the are of code:

    // I need to determine correct arguments for LIMIT from the given page number

    $from = ($page - 1) * $config["thumb_num"];

    $sql = "SELECT * FROM `".$TABLE_PREFIX."collections` WHERE id IN ($imlist) LIMIT ".$from.",".$config["thumb_num"] . " ORDER by 'name'";
    $result = run_query($sql);

    Dan
    • CommentAuthorFaken
    • CommentTimeNov 12th 2005
     
    Oops... looks like I got the space to work... but still a simialr error. You can see the space is now in the error:

    You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDER by 'name'' at line 1

    SELECT * FROM `plogger_collections` WHERE id IN (-1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,33,34,35,36,37,38,39,40,41) LIMIT 0,20 ORDER by 'name'

    Dan
    •  
      CommentAuthormike
    • CommentTimeNov 13th 2005
     
    I think your parameter order is messed up, "ORDER by" should precede the LIMIT parameter.

    So your SQL statement should read:
    SELECT * FROM `plogger_collections` WHERE id IN (-1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,33,34,35,36,37,38,39,40,41) ORDER by 'name' LIMIT 0,20
    • CommentAuthorFaken
    • CommentTimeNov 13th 2005
     
    *throws in towl*

    LOL! I guess this is just way too over my head :( I don't know where to check any of that :/

    Thanks anyhow guys :)

    Dan
    • CommentAuthorddejong
    • CommentTimeNov 13th 2005
     
    Seriously, Dan, you're too close to give up. Just copy and paste what Mike has above; it should work just fine.

    Derek
    • CommentAuthorFaken
    • CommentTimeNov 13th 2005
     
    I'm just confused... where exactly do I copy that? I don't know what line that is (I really know jack about coding). I found where to put your code that you gave me, but no idea what to do with Mike's. :( Can you just tell me the file/approx line number this should be in?

    Dan
    • CommentAuthorddejong
    • CommentTimeNov 14th 2005
     
    MySQL isn't happy with where you put the ORDER clause. Don't think of it as programming, just grammar (syntax).

    Find the line you replaced my initial code (faulty). Replace it with this:
    $sql = "SELECT * FROM `".$TABLE_PREFIX."collections` WHERE id IN ($imlist) ORDER by `name` LIMIT ".$from.",".$config["thumb_num"]";

    Sorry, when I gave the initial "something like this" code, I didn't even know 'name' was an actual field in the table or that mySQL wouldn't take the ORDER clause after LIMIT. I was trying to give you a general idea of how to go about it. This (above) is exactly how to do it.

    Regards,
    Derek
    • CommentAuthorFaken
    • CommentTimeNov 14th 2005 edited
     
    EDIT - We're in business thanks!!! Figured out the error... your last line of code had an extra " at the end before the semi-colon. Thanks so much everyone!

    Btw, I plugged your site in Community Buzz on Pixel2life.com, so you should get some good traffic from that :)

    Thanks so much D!

    Dan
    • CommentAuthorFaken
    • CommentTimeNov 14th 2005 edited
     
    *ignore this*
    • CommentAuthorThorsten24
    • CommentTimeJul 11th 2007 edited
     
    Hi,

    I still have a problem with that (plogger 2). I'd like to order the collections ascending (a to z), but I always get z to a as a result.

    I integrated the ASC command without any success:
    $sql = "SELECT * FROM `".$TABLE_PREFIX."collections` WHERE id IN ($imlist) ORDER by `name` ASC LIMIT ".$from.",".$config["thumb_num"];

    Do you have any suggestions on that? (I can't make the upgrade to plogger 3 right now.)

    Thank you in advance.
    Thorsten