We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 16410
    • 7 Posts
    Hi everyone
    I’m new to Modx and got question.
    How to display all child documents content as they are without any &tpl to format them.
    Eg: I have one main document and every child document has it’s own content (some text or other diffrent Ditto executions). I want to display all children regarding content only with no template.
    Is it possible with Ditto? If so, how can I make it work? If not, what should I do?

    p.s. I need to generate XML from child documents dynamicly thats why I need it that way.

    I’ll be very happy for any help! Thanks.
      • 7455
      • 2,204 Posts
      whell you always need an &tpl to show somthing but the contents of that tpl could just be [+content+] that way ditto will show the content you could do somthing like this:

      [!ditto? &parents=`12` &tpl=`@CODE [+content+]` total =`all` !]

      the problem with ditto on the pages you grab with ditto is that they need to be cahed or it will not parse. and the main call should be uncached like above call.


      Dimmy
        follow me on twitter: @dimmy01
        • 16410
        • 7 Posts
        thanks mate, but it doesn’t work as expected.

        the result is:
        <p>&tpl either does not contain any placeholders or is an invalid chunk name, code block, or filename. Please check it.</p><p>&tpl either does not contain any placeholders or is an invalid chunk name, code block, or filename. Please check it.</p><p>&tpl either does not contain any placeholders or is an invalid chunk name, code block, or filename. Please check it.</p>` ]]` ]]` ]]` ]]` ]]` ]]` ]]` ]]` ]]` ]]` ]]` ]]` ]]` ]]` ]]` ]]` ]]` ]]` ]]` ]]` ]]` ]]` ]]` ]]` ]]` ]]` ]]` ]]` ]]` ]]` ]]` ]]` ]]` ]]` ]]` ]]` ]]` ]]` ]]` ]]` ]]` ]]` ]]` ]]` ]]` ]]` ]]` ]]` ]]

        here’s site structure:

        I want to display only [content] field (text only) of Head, Content and Footer section.
        Eg. Head section contains code:
        [[Ditto? &parents =`[*id*]` &tpl=`headerChunk` ]]


        and what if child document content has another Ditto execution for displaying it’s children?
        maybe there is another way, without Ditto to pull child content on it’s parent?

        i want only text data from children, because MODx will pull out XML data for FLASH site.
          • 27444 ☆ A M B ☆
          • 117 Posts
          I have a similar prob, if anyone could suggest a way smiley
            Steven James McLean
            Tech Lead
            springbokagency.com
            • 19369
            • 1,098 Posts
            Try like this:

            add this call in your template and change the id for &parents=``:
            [!Ditto? &parents=`4` &tpl=`dittotemplate`!]


            then create "dittotemplate" chunk, with this:
            [+content+]
              • 17412
              • 270 Posts
              Another way to count Ditto docs:

              [!Ditto? &parents=`2` &paginate=`1` &display=`1` &tpl=`doc-count`!]


              Not sure why paginate is required though hey it didn’t return a value without.

              Chunk doc-count uses Ditto placeholder [+total+]

              [+total+]
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                Because the page count is part of the pagination function, and isn’t implemented unless the pagination is specified.
                  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
                  • 17412
                  • 270 Posts
                  Thanks Susan smiley