We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 15004
    • 6 Posts
    Hi Everybody,

    i’m wondering, could i get Ditto 2.0 to sort my documents alphabeticaly??
    is there a way?
    Thank You for Your help!

    jules
      • 36926
      • 701 Posts
      Hi Jules,

      Try adding the following parameter to your ditto call &sortBy=`[*pagetitle*]`. That is of course if it’s the pagetitle you want sorted Alphabetically.

      Ben
        • 7231
        • 4,205 Posts
        &sortBy=`pagetitle` &sortDir=`ASC`
        This should sort alphabetically by pagetitle. grin

        Ben: If you sortBy the placeholder you are using the output of the placeholder (the actual string) rather than the reference. wink
          [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]
          • 25663 MODX Staff
          • 12,272 Posts
          You may be running into problems with MySQL 5.0.51, too. It has sorting issues due to the required GROUP BY clause (a known bug in MySQL).
            Ryan Thrash, MODX Co-Founder
            Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
            • 15004
            • 6 Posts
            Thank You, it works very well!
            i only got problem, that it puts 11 after 1, and not 2. there is no problem if i use characters.
              • 36926
              • 701 Posts
              Quote from: dev_cw at Jan 18, 2009, 04:59 PM

              Ben: If you sortBy the placeholder you are using the output of the placeholder (the actual string) rather than the reference. wink

              dev_cw: Can explain exactly what you mean by the actual string and the reference, what would the difference be huh
                • 7231
                • 4,205 Posts
                Can explain exactly what you mean by the actual string and the reference, what would the difference be  huh
                This is what I mean. If you have a document with the pagetitle set to "My Blog" and you set the parameter like this:
                &sortBy=`[*pagetitle*]`
                The result would be the same as saying:
                &sortBy=`My Blog`
                This will send Ditto looking for a TV named ’My Blog’ (’My Blog’ is the string value of the variable ’pagetitle’ for the current page) since there is no document field with that name.

                What you want to do is tell Ditto to use the pagetitle field as the source for the sorting, and the returned value for pagetitle as the value to sort by. You could use any document or template variable as the sorting source (introtext, longtitle, id, alias,.) and Ditto will get the value for you.
                &sortBy=`pagetitle`
                  [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]
                  • 36926
                  • 701 Posts
                  Quote from: dev_cw at Jan 19, 2009, 04:58 PM

                  Can explain exactly what you mean by the actual string and the reference, what would the difference be huh
                  This is what I mean. If you have a document with the pagetitle set to "My Blog" and you set the parameter like this:
                  &sortBy=`[*pagetitle*]`
                  The result would be the same as saying:
                  &sortBy=`My Blog`
                  This will send Ditto looking for a TV named ’My Blog’ (’My Blog’ is the string value of the variable ’pagetitle’ for the current page) since there is no document field with that name.

                  What you want to do is tell Ditto to use the pagetitle field as the source for the sorting, and the returned value for pagetitle as the value to sort by. You could use any document or template variable as the sorting source (introtext, longtitle, id, alias,.) and Ditto will get the value for you.
                  &sortBy=`pagetitle`


                  Duh, of course makes sense.

                  Thanks

                  Ben