We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28451
    • 46 Posts
    Hello,

    I have a Ditto call going through a container of documents (some news), with a bit of javascript on top, like so: http://info.bornholm-gym.dk/index.php?id=16

    That’s pure text, and works fine.

    However, I want to add todays dish from a Google Calendar, so I found the GoogleEvents snippet: http://www.modxcms.com/Google-Events-1301.html

    And I got that to work on its own, like this: http://info.bornholm-gym.dk/index.php?id=18

    However, when I try to put that into a Ditto call, it displays the snippet call in pure text, not the end result. Like this: http://info.bornholm-gym.dk/index.php?id=16

    (it switches to the rest of the news after a few seconds)

    How can I fix this? Thankyou in advance!
      • 7231
      • 4,205 Posts
      Have you tried turning the document to not be cached? Or have you tried using cached tags with the snippet [[ ]] rather than [! !].
        [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]
        • 10449
        • 956 Posts
        Snippets within snippets need to use alternate syntax:

        [[Ditto? &myParam=`[!anotherSnippetHere!]`]] or
        [!Ditto? &myParam=`[[anotherSnippetHere]]`!]
          • 28451
          • 46 Posts
          Quote from: dev_cw at Apr 23, 2008, 08:54 AM

          Have you tried turning the document to not be cached? Or have you tried using cached tags with the snippet [[ ]] rather than [! !].

          Using [[ ]] worked, thankyou very much. Works perfectly now.
            • 22448
            • 241 Posts
            I was trying to call GetField from within Ditto but for some reason Ditto was not getting the returned field values.
            Here’s the problematic call:
            [[Ditto?&documents=`[!GetField?&docid=`2`&field=`featuredNews`!]` &depth=`0`&dateSource=`timeStamp` &tpl=`@FILE:assets/arc_chunks/article_summary_news.chk`&display=`2`&sortBy=`timeStamp`]]

            Ditto is called cached and GetField uncached. Interestingly [!GetField?&docid=`2`&field=`featuredNews`!] by itself worked just fine.

            Then i switched the call types to Ditto uncached and GetField cached and it worked.
            [!Ditto?&documents=`[[GetField?&docid=`2`&field=`featuredNews`]]` &depth=`0`&dateSource=`timeStamp` &tpl=`@FILE:assets/arc_chunks/article_summary_news.chk`&display=`2`&sortBy=`timeStamp`!]

            I can’t think of why that would be though, but that’s how it worked for me. I’m on MODx 0.9.6.2 / PHP5 / MySQL 5

            Hope this helps.

              • 28042 ☆ A M B ☆
              • 24,524 Posts
              That order of snippets cannot work. The cached Ditto call is being processed, but the uncached GetField snippet is not being processed. A cached snippet is processed right away, and any other snippet calls inside of it will not have been processed so their values will not be available to the first snippet. An uncached snippet is not processed in that pass of the parser; its tags are converted from [!...!] to [[...]] and it is skipped.

              When nesting snippets, the first snippet must be uncached, so that it is not processed during this pass of the parser, while the inner snippet is cached, so it is processed. Then in the next pass, the outer snippet is processed with the output of the inner snippet in the parameter.
                Studying MODX in the desert - http://sottwell.com
                Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                Join the Slack Community - http://modx.org
                • 3749
                • 24,544 Posts
                Quote from: sottwell at Sep 01, 2009, 11:29 PM

                When nesting snippets, the first snippet must be uncached, so that it is not processed during this pass of the parser, while the inner snippet is cached, so it is processed. Then in the next pass, the outer snippet is processed with the output of the inner snippet in the parameter.

                Have you tested this in Revolution? I’m wondering if it’s still true.
                  Did I help you? Buy me a beer
                  Get my Book: MODX:The Official Guide
                  MODX info for everyone: http://bobsguides.com/modx.html
                  My MODX Extras
                  Bob's Guides is now hosted at A2 MODX Hosting
                  • 28042 ☆ A M B ☆
                  • 24,524 Posts
                  If this is Revolution, then the inner snippet should be [[...]] as well. Seeing the uncached snippet call, I just presumed this was Evolution.
                    Studying MODX in the desert - http://sottwell.com
                    Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                    Join the Slack Community - http://modx.org
                    • 3749
                    • 24,544 Posts
                    Quote from: sottwell at Sep 02, 2009, 04:41 AM

                    If this is Revolution, then the inner snippet should be [[...]] as well. Seeing the uncached snippet call, I just presumed this was Evolution.

                    I think it is Evolution the OP is talking about.

                    I was just reminded that I meant to ask if you’ve tested the nested snippet caching in Revolution yet.
                      Did I help you? Buy me a beer
                      Get my Book: MODX:The Official Guide
                      MODX info for everyone: http://bobsguides.com/modx.html
                      My MODX Extras
                      Bob's Guides is now hosted at A2 MODX Hosting