We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8924
    • 10 Posts
    Thank you very much Splittingred.
    These 2 chunks work perfectly. Maybe we should ditto "conversion" to Revo to use it.

    Gian Paolo

    Btw: how do I put automatically in different pages news from different sources?
      • 8924
      • 10 Posts
      Quote from: pcmodem at Apr 12, 2010, 05:42 PM

      What did you name your chunk?

      the chunk used as template in ditto is my_news so as in the code
      [[ditto? &tpl=`my_news` &parents=`25`]]
      


      Gian Paolo
        • 30310
        • 6 Posts
        This is definitely a Ditto problem, related to the fact that MODx no longer returns these fields in UNIX timestamp format; these are returned in the standard MySQL datetime format and can be easily formatted with the strtotime and date output filters, i.e.
        [[+publishedon:strtotime:&display=`20` &total=`20`date=`%b %e, %Y`]]


        Thanks for this, but I am not sure how I get this working as a parameter for Ditto, my date is a TV and so I believe I need to pass it through ditto’s dateSource parameter to get it to my template chunk:
        [[Ditto? &parents=`40` &tpl=`event_blog` &orderBy=`[[unixtime? &timeStr=`eventDate`]] ASC` &dateSource=`eventDate:strtotime`]]


        I wrote a snippet (unixtime) which converts from string to unix timestamp which seems to work for orderby, it doesn’t work for dateSource though, and I don’t know whether I can use the filters in the way I have tried here.

        My chunk looks like this:
        <h3>[[+title]] - [[+date]]</h3>
        <p>[[+introtext]] <a href="[[~[[+id]]]]">More >></a></p>


        I am getting Dec 69 as my date, can any suggest a way I might get this to work?

        Thanks

        Tom
        • Quote from: tomhollis at Sep 28, 2010, 08:06 AM

          I am getting Dec 69 as my date, can any suggest a way I might get this to work?
          Is there a reason getResources will not work for your needs here? TBH, Ditto needs a lot of work for Revolution and no one has yet stepped up to volunteer to maintain it.
            • 30310
            • 6 Posts
            Quote from: OpenGeek at Sep 28, 2010, 01:25 PM

            Is there a reason getResources will not work for your needs here?

            I don’t think so, I will try that, thanks

            Tom
              • 6332
              • 8 Posts
              I use Ditto to generate google sitemap xml. I am not sure if its possible to do with getResources.
              I have fixed incorect date by fixing 2 lines in ditto.class.inc.php:

              Line 964 contains:
              $resource[$dateSource] = $dateValue + $modx->config["server_offset_time"];

              replace it with this code:
              $resource[$dateSource] = date("Y-m-d H:i:s",strtotime(date("Y-m-d H:i:s", strtotime($dateValue)) . " +".$modx->config["server_offset_time"]." hours"));


              And line 294 contains:
              $placeholders['date'] = strftime($dateFormat,$timestamp);

              replace it with this code:
              $placeholders['date'] = strftime($dateFormat,strtotime($timestamp));


              Its ugly fix and there must be better way to fix this issue, but my coding skills are not good enoug to come up with easier date/time conversions

                • 36592
                • 970 Posts
                Quote from: dafyk at Sep 29, 2010, 08:28 PM

                I use Ditto to generate google sitemap xml. I am not sure if its possible to do with getResources.

                I’m using GoogleSiteMap snippet on Revo.
                http://rtfm.modx.com/display/ADDON/GoogleSiteMap
                  • 1081
                  • 7 Posts
                  Thanks a lot dafyk. i fix the ditto date problem in a minute.
                    • 40463
                    • 4 Posts
                    Quote from: pcmodem at Apr 08, 2010, 04:44 PM
                    I am running:
                    MODx Revolution 2.0.0-rc-1 rev6614
                    Ditto 3.0 Alpha 3

                    The formatting is coming out "By Default Admin User on December 31, 1969 18:33." The publishedon date is not December 31, 1969, it is April 09, 2010

                    [[Ditto? &parents=`11` &display=`2` &tpl=`ditto_news` &dateSource=`publishedon` &dateFormat=`%B %d, %Y %H:%M` &paginate=`1` &extenders=`summary` &paginateAlwaysShowLinks=`1`]]


                    <div class="ditto_summaryPost">
                      <h3><a href="[[ ~[[+id]] ]]" title="[[+title]]">[[+title]]</a></h3>
                      <div class="ditto_info" >By <strong>[[+author]]</strong> on [[+date]]. </div>
                      [[+summary]]
                      <p class="ditto_link">[[+link]]</p>
                    </div>


                    Any thoughts?

                    I made a fix, Just open Ditto snippet in manager, and find line:
                    for ($x=$start;$x<$stop;$x++) {
                                $template=$ditto->template->determine($templates,$x,0,$stop,$resource[$x]["id"]);

                    Add A Line Before This:
                    $renderedOutput=....


                    Line:
                    $resource[$x]['publishedon']=strtotime($resource[$x]['publishedon']);

                    enJoy the Russian Coders ))
                      Code-Byte Developer and Executive Producer