We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 38651
    • 4 Posts
    So I have a bunch of documents I want to list and using the following Ditto call works perfectly:
    [[Ditto? &parents=`21` &tpl=`news_archive` &orderBy=`createdon DESC`]]


    Except that it sorts by ID instead of the creation date (where could it pull the creation date from anyway?). Changing it to this:
    [[Ditto? &parents=`21` &tpl=`news_archive` &orderBy=`publishedon DESC`]]

    returns 'No documents found'. What am I doing wrong?

    Could it be about that MySQL 5.0.51 ordering bug issue? I'm not sure about my client's MySQL version as of yet but it's 5.0. My Ditto version is 2.1 and I'm using Revolution 2.0.8.

    I've considered using Wayfinder instead of Ditto but it seems to have some issues on Revo and it would surely be simpler to just get this Ditto call working rather than creating a Wayfinder template and everything.

    This question has been answered by frogabog. See the first response.

    [ed. note: wannabe last edited this post 13 years, 9 months ago.]
      • 38651
      • 4 Posts
      OR if someone would be kind enough to convert my Ditto template to a Wayfinder one, that would be brilliant and illustrative as I don't quite understand how the multichunk templates on Wayfinder work. Here's what I'm using for the call above:
      <div class="post">
                           <p>[[+publishedon]]</br>
                           <a href="[[~[[+id]]]]">[[+title]]</a></br>
                            [[+introtext]]</p>
                          </div>
      
      • discuss.answer
        • 10208 ☆ A M B ☆
        • 1,780 Posts
        Wayfinder works best for menus. If you're just calling resources for listing, you'll want to use getResources.

        Especially if you're ordering them by publishedon (not sure you are, but it's an option) and would like to use the introtext in the display.

        [[!getResources? 
        &parents=`[[*id]]`
        &tpl=`yourOutputChunk`
        &sortby=`{"publishedon":"ASC"}`
        &showUnpublished=`1`
        &showHidden=`1`
        &includeTVs=`1`
        &processTVs=`1`
        ]]


        yourOutputChunk:
        <div class="post">
        <p>[[+publishedon]]</br>
        <a href="[[~[[+id]]]]">[[+title]]</a></br>
        [[+introtext]]</p>
        </div>


        p.s. - Wayfinder does not have issues in Revo. It's a lovely snippet that does exactly what you tell it to do, nothing more, nothing less. :~}
          Frogabog- MODX Websites in Portland Oregon
          "Do yourself a favor and get a copy of "MODX - The Official Guide" by Bob Ray. Read it.
          Having server issues? These guys have MODX Hosting perfected - SkyToaster
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Ditto has long been deprecated for Revo, use getResources instead. http://rtfm.modx.com/display/ADDON/getResources

          Wayfinder is mostly useful in the case of nested menu structures. For reference, I've gathered some useful documents and links for Wayfinder here http://sottwell.com/articles/wayfinder.html
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 38651
            • 4 Posts
            Welp, that helped alot, much thanks! The more you know.

            Apparently the [[+title]] tag has been replaced with [[+pagetitle]], which caused lots of additional trouble.

            One problem retains though; sorting by publishedon works in templates that way, but when I call the snippet in a document the resources are still sorted by ID. Do I need to typeset it differently since
            &sortby=`{"publishedon":"ASC"}`

            isn't doing the trick?
              • 10208 ☆ A M B ☆
              • 1,780 Posts
              Are you still using Ditto, or Wayfinder?

              If you're using Wayfinder, the parameters are &sortBy=`fieldname` and &sortOrder=`ASC` (or DESC).

              or, it's possible that &sortby should really be &sortBy if you're using Ditto (never used it, just guessing at the parameter case)
                Frogabog- MODX Websites in Portland Oregon
                "Do yourself a favor and get a copy of "MODX - The Official Guide" by Bob Ray. Read it.
                Having server issues? These guys have MODX Hosting perfected - SkyToaster
                • 38651
                • 4 Posts
                I switched to Wayfinder. Actually, disregard my post above, it was just a brainfart involving a text editor and too little sleep. It works either way, by the shorthand property or with separate parameters.

                Ditto is still returning the error, having solved all these other little problems that originally led me to frustration. Thanks again for directing me to the right snippet if anything! <3