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

    Modx Newbie here. I’m having a problem trying to get Ditto to read my TV date.

    The ditto call i’m making is:

    [!Ditto? &parents=`10` &tpl=`newspage` &extenders=`dateFilter` &dateSource=`docdisplaydate` &dateFormat=`%c` &sortBy=`docdisplaydate` !] 


    The TV is set to: input type = date and widget = Unixtime

    I’m getting this error:

    PHP error debug
    Error: strftime() expects parameter 2 to be long, array given
    Error type/ Nr.: Warning - 2
    File: /home/epicnet/public_html/gf/assets/snippets/ditto/classes/ditto.class.inc.php
    Line: 294
    Line 294 source: $placeholders[’date’] = strftime($dateFormat,$timestamp);

    I’m guessing that the problem is with the date formatting as when i write out my TV date I get a random number which i Guess is something to do with Unix, I have tried changing the widget to date and also not setting it?

    Any help would be much appreciated.

      • 16278
      • 928 Posts
      Do you have a server time offset in your configuration? If so, you could be hitting a Ditto bug I’ve seen before. Take a look at http://modxcms.com/forums/index.php/topic,35089.msg218405.html#msg218405

      That "random number" is probably the (correct) output from the unixtime widget, representing the number of seconds elapsed since 1st January 1970.

      smiley KP
        • 22369
        • 11 Posts
        Hi KP,

        Thanks for the pointer - you were on the money.

        I’m getting closer to my goal now, but I’m not able to format the unixtime for the ditto call - Reflect is fine, would you have any other ideas on this?

        here are the calls I’m making:
        [!Reflect? &getDocuments=`1` &id=`news` &dateSource=`docdisplaydate` &dittoSnippetParameters=`parents:10|dateSource:docdisplaydate|dateFormat:%c` &dateFormat=`%c`!]


        [!Ditto? &parents=`10` &extenders=`dateFilter` &tpl=`newspage` &id=`news` &sortBy=`docdisplaydate` &dateSource=`docdisplaydate` &dateFormat=`%c` !] 


        Kind regards,
          • 22369
          • 11 Posts
          Re the unixtime stamp problem, I just found your post (http://modxcms.com/forums/index.php/topic,35089.msg213759.html#msg213759) which worked for me as well!

          So thanks a lot for that as well, your a good man.

          oroojo