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 sure this has been answered elsewhere, but I can’t find the answer so sorry.

    I have a TV called showdate. This displays a date, and has to be in Unixtime in order for Ditto to sort it correctly on a listings page. On the listings page I can get it to display correctly by adding &dateFormat=`%d/%m/%y` to the Ditto call - but when you click through to the actual page, it’s still displayed in UNIX format.

    Is there any way of changing the display of the TV in a template? eg if you could use something like [*showdate* &dateFormat=`%d/%m/%y`] (nb I know that doesn’t work, it’s just an example of what I would like to be able to do).
      • 7231
      • 4,205 Posts
      You have a few options:

      1) You can use the DateTime snippet to format the date.

      2) You can use PHx to format the date (it is included to use within Ditto a tpl but you need to inslall it to use it outside ditto tpl - works almost like you described).

      PHx is a place holder extender that gives you all sorts of cool features to placeholders. There is a good documentation in the wiki
        [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]
        • 20477
        • 25 Posts
        Thank you, thank you, thank you!!! PHx works a charm.
          • 27
          • 117 Posts
          using [+tvDate:date=`%A %d, %B %Y`+] worked perfectly for me! yay PHx, yay MODx!
            • 15558
            • 108 Posts
            Hi there,


            I am both using the PHx plugin AND the [[AuthorTime]] snippet in the same template.

            Here it is :
            [*GigDate:date=`%d.%m.%Y`*]
            <span class="authorTime">[[AuthorTime? &dateFormat=`%d %B %Y - %H:%M` &usedDate=`pub_date` &tpl=`par <strong>[+Author+]</strong> le [+Date+]`]]</span>



            Guess what ? There is a problem.

            If I consider the PHx-modified TV, it works fine.
            If I just make the AuthorTime snippet call, it works as I want to.

            But if I try to combine both, like in the code posted above, the snippet call won’t work no more...

            Deactivating the PHx plugin permits me to output both TV and Snippet call results, but the (date) TV value appears then, obviously, as Unixtime... Can somebody tell me more about this conflict ? how can I resolve this ?

              Sorry for that ⇧ , I'm no dev but I wanna try