ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

What is the query EE Gallery uses for ORDER BY "date"?

November 20, 2007 2:09pm

Subscribe [2]
  • #1 / Nov 20, 2007 2:09pm

    Erin Dalzell

    790 posts

    I am trying to mimic the EE Gallery ORDER BY “date” query and I am having some difficulty. There seems to be a secondary sort being used if the entry_date field is the same, but I am not sure what it is.

    Does anyone either know what the query is, or where I can look it up?

  • #2 / Nov 20, 2007 2:45pm

    BlackHelix

    226 posts

    I’m thinking you add this:

    Order by e.entry_date desc

    Hope that helps!

  • #3 / Nov 20, 2007 2:51pm

    Erin Dalzell

    790 posts

    Yup, that’s what I have…it doesn’t match though where the entry_date is the same.

  • #4 / Nov 20, 2007 3:01pm

    BlackHelix

    226 posts

    Okay, it’s “
    Order by e.entry_date, e.entry_id desc

    I pulled that straight from the code.  Hope that helps! 

    You can change it from desc to asc if you’d like.

  • #5 / Nov 20, 2007 3:05pm

    Erin Dalzell

    790 posts

    Just for my info, where did you find that code?

    Thanks

  • #6 / Nov 20, 2007 3:12pm

    BlackHelix

    226 posts

    It’s in the gallery module file, mod.gallery.php. 

    The order by clause is built around lines 631-679 in the standard file.  It’s in the function that builds the sql for the gallery. 

    Glad I could help.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases