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

    i’ve juste ran into a slight issue i can’t find the reason

    i’ve a ditto call ending with the usual &tpl=`toto`, in that "toto" chunk i call a snippet [!anotherToto!]
    this snippet is used to add another chunk inside the first one depending on the content var being empty or not

    everything works fine calling {{toto}} in a page (with TV vars instead of ditto placeholders in toto of course)

    the ditto call displays the first chunk fine but displays the snippet call [!anotherToto!] instead of getting the snippet output

    then i’m wondering if there is a peculiar way to achieve this within a ditto call or would writing a snippet that ouputs two different ditto call depending on that content value the only way to get it work ?

    thanks for any advice smiley

    have swing

    PS of course, is it necessary to say that all this in written without richtext in the template and outputs [! !] correctly in the source code ? smiley
      réfléchir avant d'agir
      • 4310
      • 2,310 Posts
      Have you tried uncached [!Ditto!] and cached [[anotherToto]]
      • The way uncached snippets work, they are not processed at all until all the rest of the document is finished. So your poor Ditto call is never getting anything to work with; all it ever sees is the snippet tags instead of your snippet’ output. By calling Ditto uncached and your snippet cached, your snippet gets processed and its output is now available for when the Ditto snippet is finally processed.
          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
          • 36404
          • 307 Posts
          hi David and Susan,

          well, my Ditto call was uncached and my snippet one too, i’ve tried to cache the snippet call in the chunk (have emptied the site cache of course), the result is quite funny, it echoes the whole Ditto call in the page instead of the snippet one smiley

          instead of
          [!dateDetail!]

          (the anotherToto snippet smiley) i get
          [!Ditto? &parents=`11` &tpl=`datePageDates` &display=`10` &paginate=`1` &paginateAlwaysShowLinks=`1` &sortBy=`dateDate` &sortDir=`ASC` &dateSource=`dateDate` &dateFormat=`%d / %m / %Y`!]

          what’s funny is that Ditto keeps working and the information that comes from datePageDate is well displayed, the only thing is that snippet dateDetail that i can’t get working

          maybe it comes from the fact that Ditto evals the whole chunk/tpl as being html + placeholders, but that displaying itself instead of a cached snippet looks funny smiley

          thanks for you help anyway smiley

          have swing
            réfléchir avant d'agir
            • 36404
            • 307 Posts
            maybe, to be a bit more precise i should give you the whole code...

            the Ditto call is what is displayed above (uncached, well i nearly always use Ditto uncached...)

            the pageDatePages chunk (cached here)
            <div class="uneDate">
                <p class="dateTitre">[+date+] - [+dateLieu+]</p>
                [[dateDetail]]
            </div>

            when dateDetail is uncached, the page displays the snippet call, when cached, it displays the Ditto call... smiley

            thanks again for taking time to answer smiley

            have swing
              réfléchir avant d'agir
              • 37909
              • 153 Posts
              Someone have a answer?
                • 7637
                • 11 Posts
                Bump!

                I'm have this weird issue too!