We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 7889
    • 12 Posts
    I have read several posts, but have yet to find exactly what I need help with. I’m just trying to list both the page of Events and the side panel summary of events in order from upcoming event to the furthest out. I have tried several things and I’m pretty sure it’s my syntax. I’m new at the PHP backend coding.

    Using modx 1.0.2

    In my tpl chunk I’m using the [+unpub_date+]. I’m doing that so the event date and time can be seen on the front end, so I’m using the unpublish function as the Date of the Event. I set the Publish date before the Unpublished (date of event) so that it will show in the "list" of events prior to the event.

    I’m using this to show the list in the side panel.
    [[Ditto? &parents=`67`&display=`4` &total=`20` &removeChunk=`Comments` &tpl=`nl_events` &orderby=`createdon DESC`!]]

    My events show, but not in the correct order. I have tried several iterations of the orderby call such as
    &orderby=`pub_date DESC`

    &orderby=`unpub_date DESC`

    &orderby=`createdon pub_date DESC`


    None of those seem to effect anything.

    Additionally, my dates are displaying as from what I read MySQL time for my unpublished date i.e. 1268196720 instead of a MM/DD/YYYY format. I haven’t really looked much into that yet as I’m more focused on getting the right order of events first.

    Thanks.
      • 4310
      • 2,310 Posts
      Try something like :
      &dateSource=`pub_date` &dateFormat=`%B %d %Y ` &orderBy=`pub_date ASC`

      In your tpl chunk use [+date+]
        • 7889
        • 12 Posts
        Sweet this worked great, I just switched the pub_date to unpub_date and it gave me the ordering I wanted and the date format was fixed. Thanks!!! Do you know how would I make it display the time from the unpub_date too?
          • 4310
          • 2,310 Posts
          Make it something like :
          &dateFormat=`%B %d %Y %H:%M:%S`

          Or have a look at the PHP Manual for a full list of options.