<![CDATA[ sorting ditto call by comments. - My Forums]]> https://forums.modx.com/thread/?thread=42357 <![CDATA[Re: sorting ditto call by comments.]]> https://forums.modx.com/thread/42357/sorting-ditto-call-by-comments?page=2#dis-post-245293 shocked]]> lastoftheromans Jul 09, 2009, 01:33 AM https://forums.modx.com/thread/42357/sorting-ditto-call-by-comments?page=2#dis-post-245293 <![CDATA[Re: sorting ditto call by comments.]]> https://forums.modx.com/thread/42357/sorting-ditto-call-by-comments?page=2#dis-post-245292 http://modxcms.com/extras/package/327
http://www.modxcms.com/forums/index.php?topic=6330]]>
sottwell Jul 09, 2009, 12:42 AM https://forums.modx.com/thread/42357/sorting-ditto-call-by-comments?page=2#dis-post-245292
<![CDATA[Re: sorting ditto call by comments.]]> https://forums.modx.com/thread/42357/sorting-ditto-call-by-comments?page=2#dis-post-245291
i have another question:
i want to be able to have a section on the page of posts with the most viewed articles. it is possible?
10x]]>
lastoftheromans Jul 09, 2009, 12:36 AM https://forums.modx.com/thread/42357/sorting-ditto-call-by-comments?page=2#dis-post-245291
<![CDATA[Re: sorting ditto call by comments.]]> https://forums.modx.com/thread/42357/sorting-ditto-call-by-comments#dis-post-245290
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.]]>
Alik Jul 08, 2009, 02:20 PM https://forums.modx.com/thread/42357/sorting-ditto-call-by-comments#dis-post-245290
<![CDATA[Re: sorting ditto call by comments.]]> https://forums.modx.com/thread/42357/sorting-ditto-call-by-comments#dis-post-245289 lastoftheromans Jul 08, 2009, 08:14 AM https://forums.modx.com/thread/42357/sorting-ditto-call-by-comments#dis-post-245289 <![CDATA[Re: sorting ditto call by comments.]]> https://forums.modx.com/thread/42357/sorting-ditto-call-by-comments#dis-post-245288 thehen Jul 08, 2009, 03:08 AM https://forums.modx.com/thread/42357/sorting-ditto-call-by-comments#dis-post-245288 <![CDATA[Re: sorting ditto call by comments.]]> https://forums.modx.com/thread/42357/sorting-ditto-call-by-comments#dis-post-245287 ]]> mrhaw Jul 07, 2009, 04:16 PM https://forums.modx.com/thread/42357/sorting-ditto-call-by-comments#dis-post-245287 <![CDATA[Re: sorting ditto call by comments.]]> https://forums.modx.com/thread/42357/sorting-ditto-call-by-comments#dis-post-245286 jflarity Jul 07, 2009, 03:33 PM https://forums.modx.com/thread/42357/sorting-ditto-call-by-comments#dis-post-245286 <![CDATA[Re: sorting ditto call by comments.]]> https://forums.modx.com/thread/42357/sorting-ditto-call-by-comments#dis-post-245285 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]]>
Alik Jul 07, 2009, 03:25 PM https://forums.modx.com/thread/42357/sorting-ditto-call-by-comments#dis-post-245285
<![CDATA[Re: sorting ditto call by comments.]]> https://forums.modx.com/thread/42357/sorting-ditto-call-by-comments#dis-post-245284 ]]> mrhaw Jul 07, 2009, 02:36 PM https://forums.modx.com/thread/42357/sorting-ditto-call-by-comments#dis-post-245284