We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6038
    • 228 Posts
    simple question - i couldn’t find the answer - i tried it out, and it doesnt seem to work - the snippet just gets output as text in the page.

    is it supposed to be able to work?
      • 33982 ☆ A M B ☆
      • 476 Posts
      You are trying to put a snippet in the introtext? I guess the obvious question is why would you want to do that? huh

      If you’re trying to call a snippet, the correct thing to do would be put it in the template, chunk, T.V. or somewhere else, but I’m not sure the reasoning behind putting it in an introtext field. What I do often is create a Template Variable just for snippets for all my templates. That way if I need to call a snippet on that specific document, I can put the snippet there and then have the T.V. in the template itself output the snippet.

      Could you explain a little bit more what you’re trying to accomplish and I could give you a better solution for you to try?
        Precision Web Development ... SmashStack.com
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        Works fine for me, cached or uncached. Are you sure your snippet works at all? It should make no difference, introtext, content, description, pagetitle... it all gets processed the same.
          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: crunch at Jul 17, 2008, 08:50 PM

          simple question - i couldn’t find the answer - i tried it out, and it doesnt seem to work - the snippet just gets output as text in the page.

          is it supposed to be able to work?

          Don’t forget that snippet names are case-sensitive. Often, when you see the snippet call on the page, you’ve misspelled the snippet name.
            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
            • 6038
            • 228 Posts
            Quote from: flinx at Jul 18, 2008, 01:12 AM

            You are trying to put a snippet in the introtext? I guess the obvious question is why would you want to do that? huh

            I have a central page which has a ditto call in the normal content area - the ditto call finds all the child documents of the first level, and displays a summary (the introtext field) for each one - but for one of the child documents in particular i want to display some text plus a list of links to children within that document/container. So i thought putting a little ditto call into the introtext field would do it for me. Does that make sense?
            If theres a more logical or practical way to do it i’m all ears...
              • 6038
              • 228 Posts
              Quote from: sottwell at Jul 18, 2008, 01:54 AM

              Works fine for me, cached or uncached. Are you sure your snippet works at all? It should make no difference, introtext, content, description, pagetitle... it all gets processed the same.

              The page in that i am trying to ditto the summary/introtext field for , has itself a ditto call in the main content of the page.
              I put that into the summary/introtext field just to test it. When you go to the actual page itself, the ditto call works, but when i put it into the introtext it doesnt seem to.

              Here is the call:
              [!Ditto? &id=`productListing` &parents=`153` &display=`all` &depth=`1` &tpl=`au_products` &orderBy=`longtitle` &sortBy=`longtitle` &sortDir=`asc` &extenders=`summary` !]

              Could it be because its a ditto call that is retrieving the introtext info which itself has another contained ditto call? ie a ditto within a ditto doesnt work?
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                That would certainly be a problem; you’d be running a loop: get the introtext which contains the snippet that gets the introtext which contains the snippet that gets the introtext... I think you can see where this is going.
                  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
                  • 6038
                  • 228 Posts
                  not quite - the first ditto call is in the parent page which looks for the introtext of 3 child documents.
                  The second ditto call is in the introtext of only one of the 3 child documents, and is a ditto call to make links to its 4 children.

                  Why cant i just do a ditto call to include all depths from the first document?
                  Because i also need some text to display for each of the first three children.
                  Neither of the other 2 children have any links to display - they only display some text.

                  Maybe there is a simpler way to do it and I havn’t understood everything Ditto can do for me - it is a complicated snippet!
                  I find it not easy to get a firm grasp on from the official documentation. Any pointers?
                    • 6038
                    • 228 Posts
                    ok - i got it to work, by making the initial ( or ’parent’ ditto call) cached, and the embedded call was left as uncached.
                    Just thought I would drop a note in for anyone else who might run up against the same issue.

                    From http://ditto.modxcms.com/index/faq.html:

                    Why are snippet calls in my Ditto template not executed?

                    This is because the current MODx parser can’t handle nested tags of the same type. You will need to alternate between cached and uncached (or vice versa) snippet calls. For example, if your Ditto call is uncached your snippet call within the Ditto template will need to be cached.

                    PS. I decided it made more sense to use a wayfinder snippet call in the end anyway!