We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 14089
    • 56 Posts
    i posted this in the general help, but was told to post here. i have set up a blog site using ditto and the comments are handled by jot. everything works great, but my problem is that i want to be able to have a section on the page of posts with the most comments. i’ve looked in the forums for a few days and have been unable to figure this out. any help would be greatly appreciated. i’m using modx 9.6.3 and ditto 2.1. thanks in advance!
      for all things independent, check out http://www.indieophile.com
      • 1122
      • 209 Posts
      Have you resolved this issue or still interested in it? Recently I implemented something of this kind -- an overlay to Ditto that produces the listing of most commented documents ordered descendingly by a number of comments attached. If there will be an interest I can submit it to public domain.
        • 14089
        • 56 Posts
        i have not resolved this issue and am very interested. thank you!
          for all things independent, check out http://www.indieophile.com
          • 20413
          • 2,877 Posts
          @Alik Please share! smiley
            @hawproductions | http://mrhaw.com/

            Infograph: MODX Advanced Install in 7 steps:
            http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

            Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
            http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
            • 1122
            • 209 Posts
            --- Several words of intro that I’ve added after the thread has been stickied by the forum moderators ----
            Some people ask how to call Ditto and sort its results by the number of comments attached. The simpliest answer is that it cannot be done within the means given by Ditto itself. Ditto "realizes" neither Jot’s existence nor the way it handles comments. This is a task for a new snippet that would correlate Ditto’s result set with a data stored in Jot-handled tables. Just this is a way that my snippet operates: 1) runs Ditto in an invisible mode to retrieve document’s ids from the scope being the topic of interest, 2) explores Jot’s table to look/count how many comments are attached to documents within a retrieved scope; 3) sorts documents descendingly by the calculated numbers.
            ----
            Here it goes. Create a new snippet, for example "TopCommented", paste into it code from attached "topcommented.txt", and run as:
            [[TopCommented? &parents=`2,46` &depth=`1` &display=`5` &filter=`type,document,1` &tpl=`ArticleListItem` &noResults=`No comments so far.`]]
            

            It means: display 5 most commented documents within 2 and 46 containers.
            At this stage of development the snippet recognizes six above-mentioned parameters that have the same meaning as in Ditto. In most cases these parameters are sufficient for effective displaying documents that have the most comments, but if you want to use/pass more Ditto-specific parameters then you need to look into snippet’s code and read explanations how to extend it. Enjoy!

            Latest version: http://setpro.net.pl/software/ditto-stuff#attachments
              • 14089
              • 56 Posts
              man, that works like a charm! thank you!!!
                for all things independent, check out http://www.indieophile.com
                • 20413
                • 2,877 Posts
                This made my day! Thank you very much for this!! cool
                  @hawproductions | http://mrhaw.com/

                  Infograph: MODX Advanced Install in 7 steps:
                  http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

                  Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
                  http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
                  • 29703
                  • 217 Posts
                  This is brilliant and very much needed! Many many thanks!
                  • gReat!
                      palma non sine pulvere
                      • 1122
                      • 209 Posts
                      Hi all,

                      many thanks for your kind words. I was wondering whether there will be someone apart from jflarity interested in this solution. (Ditto is sophisticated enough for the use as a standalone product so let alone combining it with Jot and giving answers for questions like "how to sort Ditto’s results by a number of comments".) Anyway, sooner or later this thread will disappear under tons of new/ongoing problems. For those interested in obtaining fresh copy of the code I have added subpage (http://setpro.net.pl/software/ditto-stuff) on my personal site where this and other snippets can easily be accessed.