We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30223
    • 1,010 Posts
    PHx gobbles up place holders in snippet calls when it shouldn’t.

    Please have a look at this discussion and a hint to a possible solution
      • 5453
      • 17 Posts
      Hi,

      When I place this in a ditto template:
      [+date+]

      I get ’28-May-07 17:51’

      But when I try to format it using PHx like this...
      [*date:date=`%a %B %d, %Y at %H:%M`*]


      I get Thu ’January 01, 1970 at 01:00’ AKA zero in unix time stamp.

      Any ideas?



        • 26407
        • 6 Posts
        Clevely,

        Are you trying to format it using a ditto chunk or a TV? If its for a TV it looks like the TV is empty and has a default value of 0. i have had no problems using PHx in both a TV or a Ditto. The other curious thing is I wonder if PHx has a bug and is seeing the first "date" string as a formatter. What happens if you change the name of the date variable?

        What about if you try to format the ditto chunk like so: [+date:date=`%a %B %d, %Y at %H:%M`+]. Do you still get the same result?

        Scott
          • 5453
          • 17 Posts
          Yeah im trying to get the date in a ditto chunk.

          Tried your code but still got Thu January 01, 1970 at 01:00

          mmmm
            • 7923
            • 4,213 Posts
            I believe that the :date modifier in PHx expects that the value to be modified is in unix timestamp form.. You can do your own date modifier by creating a snippet with name phx:mydate and with this content:

            <?php
            return strftime($options, strtotime($output));
            ?>
            


            Then in the chunk, use [+date:mydate=`%a %B %d, %Y at %H:%M`+]


              "He can have a lollipop any time he wants to. That's what it means to be a programmer."
              • 5453
              • 17 Posts
              Thanks doze that worked like a treat.

              Thanks loads.

              John
                • 11413
                • 203 Posts
                Oh god! You’re saving my life and brain! It’s really an awesome plugin! Two thumbs up!
                  Blaise Bernier

                  www.medialdesign.com - Solutions for small business, hosting, design and more!
                  • 21056
                  • 327 Posts
                  I’ve made some improvements to PHx, allowing it to get custom modifiers from files, as well as snippets. This is much easier when it comes to distributing custom modifiers (as they can simply be downloaded, rather than having to be copied into database) and copying between sites, or incorporating into new sites.

                  Can anyone see any drawback to this approach, or any reason why it shouldn’t be used? I’ve contact the author, but no reply yet.

                    Author: ManagerManager plugin - customise your ModX manager interface

                    Rckt - web development, Sheffield, UK
                    • 25663 MODX Staff
                    • 12,272 Posts
                    Armand is very busy being a dad for the first time. I don’t think anyone would object, and personally think it’s a great idea. smiley
                      Ryan Thrash, MODX Co-Founder
                      Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                      • 21056
                      • 327 Posts
                      Quote from: rthrash at Jun 25, 2007, 08:27 AM

                      Armand is very busy being a dad for the first time. I don’t think anyone would object, and personally think it’s a great idea. smiley

                      Understandable then!! I’ll tidy up the files and upload them to the repository.
                        Author: ManagerManager plugin - customise your ModX manager interface

                        Rckt - web development, Sheffield, UK

                      This discussion is closed to further replies. Keep calm and carry on.