We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4120
    • 21 Posts
    When Ditto list pages they are ordered oldest (on top) to newest (on bottom). Is there a way I can rearrange this so the newest page is listed first.

    [[Ditto? &dateFormat=`%c` &tpl=`ditto_blog &summarize=`all` &extenders=`summary`]]
      • 36592
      • 970 Posts
      You can change sort order by using &orderBy parameter.
      But I think its default is &orderBy=`createdon DESC`, so the newest comes at the top of the output listing...

      Are you possibly using MySQL 5.0.51 ?
        • 25663 MODX Staff
        • 12,272 Posts
        Moving to appropriate topic.
          Ryan Thrash, MODX Co-Founder
          Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
          • 4120
          • 21 Posts
          I am using MySQL v5.0.27. It looks like I should update that. I just realized that when I created all the pages I created the newest first and the oldest last. Could I use the publish date input and then sort by pub_date?
            • 10449
            • 956 Posts
            Yep. Use &sortBy (field: createdon, pub_date, editedon etc.) + &sortDir (ASC or DESC)
              • 36592
              • 970 Posts
              Quote from: brjulias at Oct 03, 2008, 08:35 AM

              I am using MySQL v5.0.27. It looks like I should update that.
              No. You don’t update your MySQL Server to ver.5.0.51.
              This version has serious bug in sorting, so I just guessed you might be using this version.

              To sort by the published date in descending order, as ganeshXL wrote, you can use &sortBy=`pub_date` and &sortDir=`DESC`.
              Or with the latest Ditto parameter &orderBy=`pub_date DESC`.
              http://ditto.modxcms.com/files/snippet-ditto-php.html
                • 4120
                • 21 Posts
                I ended up sorting by menuIndex, and now everything is working great. Thanks for your help.
                  • 15197
                  • 65 Posts
                  How do I sort alphabetically??? I found the question asked once, but never answered. I’ve tried:

                  [!Ditto? &parents=`12` &total=`40` &orderBy=`title DESC` &tpl=`resourceTpl`!]

                  It’s sorting differently from the default, but it’s not alphabetical.
                    • 10449
                    • 956 Posts
                    &orderBy=`title DESC`
                    title is not a valid document variable. Use pagetitle or longtitle, or any of the other doc vars
                    hence: &orderBy=`pagetitle DESC` or &orderBy=`longtitle DESC` etc.

                    Here’s a listing of all of the available document-specific variables: http://svn.modxcms.com/docs/display/MODx096/Document+Object