2018-06-21, 04:40

Feb 27, 2012 — Notify Users module, ver. 0.5 released — user can choose between sending single message (...) »

2013-01-28, 08:32

19 студзеня 2013 у Гродне трагічна загінуў паэт, журналіст і мой сябар (...) »

2009-10-14, 07:19

The site Litaratura.org is devoted to Belarusian literary works and translations. (...) »

2009-01-12, 20:46

Late November 2008 marked the 20th anniversary of the official founding of the Belarusian (...) »

Registered User Area Log into This Site
Show Credits... Credits
~ / Public Domain Software / Extensions to Ditto / MostCommented Snippet $_
MostCommented Snippet
Click To View A Full Size Image...
2010-01-10, 15:09

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

MostCommented snippet recognizes six parameters — parents, depth, display, filter, tpl, and noResults — that have the same meaning as in Ditto call. If you want to use more Ditto-specific parameters you need to look into the snippet’s code and follow the instructions on how to extend it.

MostCommented snippet has been initially posted to this thread on MODx Forum.

How to use MostCommented

# 1) create new snippet 'MostCommented' and paste into it content of the attached mostcommented.txt file
# 2) call your snippet something as:
[[MostCommented? &parents=`2,46` &depth=`1` &display=`5` &filter=`type,document,1` &tpl=`item-chunk` &noResults=`No comments so far.`]]
# 3) please read more details on parameters in snippet's header

Download This Attachment... MostCommented Snippet — the very latest version
Last modified: 2009-09-29, 00:00 — Size: 3,24 KB