We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 23428
    • 27 Posts
    I’ve been trying to sort articles by something other than the date created; e.g. menu order or published date. I’m hoping this will mean the administrator can move articles around and have more control over the order their news articles are shown in. However I can’t seem to get sortBy or orderBy to work ... everything else seems to in my code such as parent id but I’ve tried both of these and they don’t work. Is it the right parameter I’m using???
      • 7231
      • 4,205 Posts
      Ditto can sort by any document or template variable. Try using the orderBy:
      &orderBy=`pagetitle ASC`


      Otherwise you can use the old syntax:
      &sortBy=`pagetitle` &sortDir=`ASC`
        [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

        Something is happening here, but you don't know what it is.
        Do you, Mr. Jones? - [bob dylan]
        • 23428
        • 27 Posts
        well i don’t know what i was trying last night but it was very similar to your code but didn’t work no matter what i did. however having copied your code in it works perfectly; it may well have been the apostrophes i was using not slanting the right way or something!!! anyway, thank you thank you thank you .. in 2 minutes you’ve helped me with something i spent frustratingly too long on!! grin
          • 7231
          • 4,205 Posts
          The most common error is using single quotes ’ rather than back ticks ` in the snippet parameter.
            [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

            Something is happening here, but you don't know what it is.
            Do you, Mr. Jones? - [bob dylan]
            • 3749
            • 24,544 Posts
            Quote from: pipedragon72 at Apr 07, 2009, 05:24 PM

            I’ve been trying to sort articles by something other than the date created; e.g. menu order or published date. I’m hoping this will mean the administrator can move articles around and have more control over the order their news articles are shown in. However I can’t seem to get sortBy or orderBy to work ... everything else seems to in my code such as parent id but I’ve tried both of these and they don’t work. Is it the right parameter I’m using???

            Are you using MySQL Version 5.0.51? It has a bug that would explain what you’re experiencing.
              Did I help you? Buy me a beer
              Get my Book: MODX:The Official Guide
              MODX info for everyone: http://bobsguides.com/modx.html
              My MODX Extras
              Bob's Guides is now hosted at A2 MODX Hosting