We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 20477
    • 25 Posts
    I’m using Ditto to call a list of shows, each of with has a date TV (using the date picker widget or whatever it’s called). The TV is called showdate.

    As you can see, the shows are not displaying in date order, but, it seems, but the actual number that is presented as the day - http://www.localism.org.uk/modx/shows.php

    Can anyone help???
      • 36592
      • 970 Posts
      I think you have to use Unixtime output widget for the date TV to sort by them.
      Check this. -> http://ditto.modxcms.com/tutorials/sort-by-a-date-tv.html
        • 18397
        • 3,250 Posts
        1. Does the TV have the Unixtime Widget set?
        2. Do you have &dateSource set to the tv name?
        3. Are you using [+date+] in your template?
          • 20477
          • 25 Posts
          1 It’s not using Unixtime, it’s using Dateformatter
          2 I’m not using &datesource, I’m using &sortby=`showdate`
          3 I am using [+date+] in the template.

          I’ll try playing about with this, having written down those points I think I may have spotted the error
            • 20477
            • 25 Posts
            Of course, yes I should have checked the link tkfm mentions - http://ditto.modxcms.com/tutorials/sort-by-a-date-tv.html

            Cheers for your help
              • 20477
              • 25 Posts
              Actually, no, I still can’t get it to work - here’s the ditto call:

              [!Ditto? &startID=`17` &summarize=`10` &total=`20` &extenders=`summary` &tpl=`BlogTemplate` &sortBy=`showdate` &datesource=`showdate` &dateFormat=`%d %b %G %H` &sortDir=`ASC`!]

              but you can see here http://www.localism.org.uk/modx/shows.php the dates are not human readable. BTW it’s the 1204812085 style dates below each show title.

              Sorry if I’m being slow, it’s been a long week...
                • 25663 MODX Staff
                • 12,272 Posts
                Check both that you’re not running any version of MySQL 5.0.51 and that you’re running the latest Ditto code (2.1).
                  Ryan Thrash, MODX Co-Founder
                  Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                  • 36592
                  • 970 Posts
                  &datesource=`showdate` 

                  This must be &dateSource (capital ’S’). Otherwise default value(’createdon’) is used as the source of [+date+].

                  &dateFormat=`%d %b %G %H`

                  How about using more simple format for testing, like ’%m/%d/%y’ ?
                    • 20477
                    • 25 Posts
                    OK, I’ve switched to UNIX time, upgraded Ditto and Reflect to 2.1.0, and changed the call to

                    [!Ditto? &startID=`17` &summarize=`10` &total=`20` &extenders=`summary` &tpl=`BlogTemplate` &sortBy=`showdate` &dateSource=`showdate` &dateFormat=`%m/%d/%y` &sortDir=`ASC`!]


                    Still not working.

                    It seems the host is fairly old - Mysql 4.1.11 and PHP 4.3.11. Would this be the problem, and am I stupid for not spotting it earlier?
                      • 36592
                      • 970 Posts
                      I think you are using [+date+] in your Ditto template called "BlogTemplate".
                      But it outputs raw unixtime despite you specifiy the output format using "&dateFormat".

                      So how about using [+showdate+] with PHx ?
                      I am not familiar with PHx plugin, but it can format the TV, I believe...

                      And check the debug output if [+date+] is outputted properly.