--- 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