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

    I have a little problem on with Ditto 2. In my documents I am using a chunk to add comments via Jot.

    Lorem ipsum dolor sit amet, consectetuer adipiscing elit. 
    Ut rutrum nisl vel est. Ut id lorem. Aenean ornare semper elit. In sagittis mauris vel ligula. 
    Donec nisl. In quis mauris ut quam molestie volutpat. Vestibulum vulputate. 
    
    {{FormBlogComments}}


    Then I use Ditto to get the documents:
    [!Ditto? &hideFolders=`1` &extenders=`summary` &trunc=`0` &summarize=`all` &depth=`10` &dateFormat=`%B %d, %Y` &removeChunk=`FormBlogComments` &tpl=`DittoCurrentCategoryEntries`!]


    Have I missed something or made a mistake? How can I remove that chunk from Ditto content? It will shows me the parse chunk with the Jot call behind.

    Thank you!
    Boby
      ...my Photo Gallery on Flickr...
      • 18397
      • 3,250 Posts
      Please attach the output of the debug console (run the snippet with &debug=`1` and click the Save Debug Console link) to your post. Thanks.
        • 3763
        • 155 Posts
        Hello Mark,

        Thank you for the help. I’ve attached the debug file.

        Boby

        PS: renamed to .txt as I’m not allowed to attach .html
          ...my Photo Gallery on Flickr...
          • 18397
          • 3,250 Posts
          Give the latest development version a try @ http://www.modxcms.com/ditto_download.html
            • 3763
            • 155 Posts
            Quote from: Mark at Mar 16, 2007, 02:56 PM

            Give the latest development version a try @ http://www.modxcms.com/ditto_download.html
            I’ve tryed it now, but it still does not work sad
              ...my Photo Gallery on Flickr...
              • 18397
              • 3,250 Posts
              Ok, I just committed a fix that should remedy the problem. Give it a try.
                • 3763
                • 155 Posts
                Nope, still not working :’(

                I’ve played a bit with the code, and moved the chunk removal to the ditto snippet code (right after line #922) instead of the ditto.class.inc.php
                <?php
                ...
                
                for ($x=0;$x<$stop;$x++) {
                
                   //REMOVE CHUNKS[start]
                   if (is_array ($removeChunk) && !empty ($removeChunk)) {
                      foreach ($removeChunk as $chunk) {
                         $resource[$x]['content'] = str_replace('{{'.$chunk.'}}',"",$resource[$x]['content']);
                         $resource[$x]['content'] = str_replace($modx->getChunk($chunk),"",$resource[$x]['content']);
                         //remove chunk that is not wanted
                      }
                   }
                   //REMOVE CHUNKS[end]
                
                   $template = $ditto->template->determine($templates,$x,0,$stop,$resource[$x]["id"]);
                   // choose the template to use and set the code of that template to the template variable
                   $renderedOutput = $ditto->render($resource[$x], $template, $removeChunk, $dateSource, $dateFormat, $placeholders,$phx);
                
                ...
                ?>



                Not sure if it’s the best mothod overall, because I don’t know the complete Ditto, but it works for me wink
                Boby
                  ...my Photo Gallery on Flickr...
                  • 3763
                  • 155 Posts
                  A little update...

                  The above does not work for RSS :’( and as a quick fix I’ve added the above code to remove chunks also to summary.extender.inc.php, at the end of the execute function. I know it’s not the best method, but that’s it tongue
                    ...my Photo Gallery on Flickr...
                    • 18397
                    • 3,250 Posts
                    Do you have PHx installed?
                      • 7515
                      • 10 Posts
                      I just had this problem with 0.9.6.2 and Ditto 2.1. The cause was calling Jot cached in my comment chunk. ([!Jot? &subscribe=`0` &pagination=`10`!] instead of [[Jot? &subscribe=`0` &pagination=`10`]].

                      I was calling it cached because I followed instructions in the wiki for creating a basic blog. Uncached calls on my main blog page resulted in displaying [!Jot....!] instead of the number of comments. I then created a separate block and instructed ditto to remove this block. Perhaps Ditto compares the output of the Jot call with the output of the page, and if one is cached, and the other is not they have different results?? Anyway, the above change fixed several problems I was having all at once.

                      {{BlogFooter}}
                      [!Jot? &subscribe=`0` &pagination=`10` &captcha=`1`!]


                      Blog entry:
                      la la la... {{BlogFooter}}


                      Ditto call:
                      [!Ditto ..... &removeChunk=`BlogFooter`!]


                      Cory