We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 34193
    • 330 Posts
    Hi folks not sure if this is a bug or me missing somthing.

    I am trying to use ditto in revolution my ditto call is

    [[Ditto? &depth=`1`&summarize=`5` &total=`20` &tpl=`newstemp`]] 


    this is in doc id 15

    my newstemp chunk is
    <h4>
    	<a href="[[~[[+id]]]]" title="[[+title]]">[[+title]]</a>
    </h4> <!-- link to blogs article with it's title (link is title) -->
    <p style="font-size:x-small;">Date [[+publishedon:date=`%d %B %Y`]] </p>
     [[+content]]<br />
    <hr />
    


    this all works fine except for the id placed in the [[+id]] is 15(page with ditto call on) not 16(the news item page). it displays the title of the item page and the content but the id of the parent page. admitadly the publishedon does not display but i anit to worried about this since that bit was copied from an old modx site.

    But I do need to try and get the link part working. Anyone any ideas or is it a bug I need to post to Jira.
      • 22303 MODX Staff
      • 10,725 Posts
      Quote from: peteedley at May 03, 2009, 05:03 AM

      this all works fine except for the id placed in the [[+id]] is 15(page with ditto call on) not 16(the news item page). it displays the title of the item page and the content but the id of the parent page. admitadly the publishedon does not display but i anit to worried about this since that bit was copied from an old modx site.

      But I do need to try and get the link part working. Anyone any ideas or is it a bug I need to post to Jira.
      Hmm, we’re using Ditto extensively on the modxcms.com site and have not seen this. Is there anything else unusual about this, or is it possible this got cached improperly? BTW, what does total=20 do? (pardon my lack of Ditto knowledge, but I rarely use it myself)

      As for publishedon, MODx Revolution now returns the timestamp fields as datetime strings in the standard MySQL datetime format. So simply add one additional filter modifier to the tag so it turns the value back into the raw Unix timestamp:
      [[+publishedon:strtotime:date=`%d %B %Y`]]
        • 34193
        • 330 Posts
        Hi thanks for the quick reply I have tried clearing the cache and stuff but will try again later when I am back on that machine. the &total limits the number of docs retreived.
          • 34193
          • 330 Posts
          OK this looks like its a problem with the template and the use of [[~[[+id]]]] not working if I use [[ditto]] without any paramaters it works fine.

          So it looks like [[~[[+id]]]] returns the id of the doc the contains ditto not the id of the doc it is returning.

          I cleared the cache in modx revo and my local browser cache and still getting it. added anouther document so that ditto is retreiving 2 and both get linked to parent doc
            • 22303 MODX Staff
            • 10,725 Posts
            Are we sure this is not related to the use of the &total parameter?
              • 34193
              • 330 Posts
              Yep removed all parameters except tpl so the call is now [[ditto? &tpl=`newstemp`]]

              And still the same problem the rest of the content of ditto output correct and as expected but the link goes to the parent/calling page.
                • 34193
                • 330 Posts
                OK this gets more weired if I use [[+id]] on its own the place holder is replaced by the ID number of the doc being processed as expected.

                As soon as I try to convert this to a link using [[~[[+id]]]] it replaces the place holder with the ID number of the calling doc.
                  • 22303 MODX Staff
                  • 10,725 Posts
                  Quote from: peteedley at May 05, 2009, 08:24 AM

                  OK this gets more weired if I use [[+id]] on its own the place holder is replaced by the ID number of the doc being processed as expected.

                  As soon as I try to convert this to a link using [[~[[+id]]]] it replaces the place holder with the ID number of the calling doc.
                  This definitely sounds like a bug in the Ditto code; I would open up a ticket for it at http://svn.modxcms.com/jira/browse/DITTO
                    • 34193
                    • 330 Posts
                    Done