We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 1932
    • 137 Posts
    First of all, awesome release Mark; thanks for all your hard work. grin

    What’s the best way to get the date placeholder as a Unix timestamp so that I can format it later in my chunk using PHx? I ended up changing a line of code for the time being but I thought the dateFormat parameter was deprecated.
      • 18397
      • 3,250 Posts
      Its not anymore... I realized that its needed for 2 reasons:

      1. UTF-8 support since PHx :date does not support it
      2. Server time offset is not applied when using PHx :date

      However, if you want to use PHx formatting on a date just use [+dateSource+] where dateSource is the source of your date.
        • 1932
        • 137 Posts
        Excellent, the reason I need it is for splitting up the day/time in one of my templates. Adding UTF-8 encoding and time offset into PHx is trivial; you could even do it as a custom modifier snippet:

        phx:mydate
        <?php
        $dt =  strftime($options, (intval($output) + $modx->config["server_offset_time"]));
        if ($modx->config["modx_charset"] == "UTF-8")
        {
            $dt = utf8_encode($dt);
        }
        return $dt;
        ?>
        
          • 18397
          • 3,250 Posts
          But would that work even if PHx is not installed globally?
            • 1932
            • 137 Posts
            I just tested and yes, it works without PHx installed as a plugin. It would probably be better to have bS add it to the native PHx date modifier (if he agrees) but this is at least a viable option for people who need it.
              • 22563
              • 63 Posts
              @ Perrine

              Thanks for the info! The possibilities of MODx still confuse me sometimes laugh
                • 29400
                • 15 Posts
                Hi there,

                I’ve got some issues with Ditto and MODx 0.96 RC1, so I’ve installed Ditto 2.0 RC2 from the svn trunk. Unfortunately that didn’t solve my problems. Actually I have some more now smiley and I’m really badly confused. Maybe somebody can give me a hint to get Ditto running again.

                What I’ve done:

                After updating the snippet I’ve got an error message about an missing [tt]date.extender.inc.php[/tt] file. Because it really isn’t there anymore I simply removed the [tt]&extender=`date`[/tt] param from my snippet call (I don’t even know what that was good for ;-). In the next step I’ve changed the startid param to [tt]&parents[/tt] as mentioned in the docs. No error message anymore, however, no documents were retrieved. After removing [tt]&tagData=`documentTags`[/tt] I’ve got my documents back again, without the tags of course. I’ve tried adding the tagging extender param... again no documents. I simply don’t know what to do to get my tagLinks back.

                By the way, my older problems are still there:

                • the [tt]&paginateSplitterCharacter[/tt] parameter seems to be ignored
                • [tt]$_lang[’date_format’][/tt] and [tt]$_lang[’more_text’][/tt] have to be passed as params, as those entries in the language file are without effect
                • I cannot call the snippet uncached [!. If I do, the nested Jot snippet calls will not be processed

                This is my snippet call:

                [[Ditto? &parents=`2` &summarize=`3` &removeChunk=`Comments-de` 
                &tpl=`ditto_blog-de` &paginate=`1` &paginateAlwaysShowLinks=`1` 
                &extenders=`summary,dateFilter` &language=`german`  &dateFormat=`%d.%m.%y, %H:%M` 
                &paginateSplitterCharacter=`|` &truncText=`Weiterlesen ...` &debug=`1` ]]


                I’m stuck right now. Any help is welcome.

                Bye,

                TDRWH
                  • 19858
                  • 15 Posts
                  It seems version 1.0.2 is avaliable with the Modx version .95 on the website. Is 2.0 just being tested right now? People are also talking about Modx versions .96, .97 and .98. Sorry if this isn’t the right place but which version should I be focusing on? I tried to use the snippet code for Ditto 2.0 and received the following error (I’m using Modx .95):

                  /home/httpd/vhosts/lynchcreekdahlias.com/httpdocs/assets/snippets/ditto/classes/ditto.class.inc.php does not exist. Please check the file.

                  I guess I also need to upload the new files for ditto 2.0. I didn’t realize I would have to do that but I guess the original files came pre-installed. Since this is a more complicated snippet, I guess it needs other files to help it work properly.

                  My goal is to be able to format the m-d-Y and I think I can do that in version 2.0.

                  If anyone has a moment to fix my confusion regarding these comments I’d love to hear from you. Thank you.
                    • 29400
                    • 15 Posts
                    I’m still confused (see my post above) smiley but maybe I can help you.

                    Quote from: mmaddux at Feb 27, 2007, 01:24 PM

                    I tried to use the snippet code for Ditto 2.0 and received the following error (I’m using Modx .95):

                    /home/httpd/vhosts/lynchcreekdahlias.com/httpdocs/assets/snippets/ditto/
                    classes/ditto.class.inc.php does not exist. Please check the file.


                    I guess I also need to upload the new files for ditto 2.0.
                    That’s right (I guess). To get the files see the first post of this thread. Update both the files and snippet code (both Ditto and Reflect) or create new snippets for testing purposes, if you don’t want to delete the older ones.

                    I don’t know which MODx version is recommended: use the stable release 0.9.5 or the 0.9.6 RC1

                    My goal is to be able to format the m-d-Y and I think I can do that in version 2.0.

                    Add the parameters [tt]&extenders=`dateFilter`[/tt] and [tt]&dateFormat=`%d.%m.%y, %H:%M`[/tt] with your formatting string. That should do what you want.

                    Bye,

                    TDRWH
                      • 18397
                      • 3,250 Posts
                      &extenders=`dateFilter` is for use in conjunction with Reflect, not for formatting dates.


                      @TDRWH: What do you mean by "$_lang[’date_format’] and $_lang[’more_text’] have to be passed as params, as those entries in the language file are without effect". If no parameter is specified those are fallbacks, not configuration parameters.

                      I will look into paginateSplitterCharacter...

                      As for the [! vs [[ call issue, that is a MODx parser limitation and has nothing to do with Ditto. MODx 0.9.7 will address this when it becomes available.

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