
Reactions
Universal reactions for MODX 3 — likes, GitHub-style sets, tops and trending on any object


Lists objects with the highest rating. Rating = likes − dislikes (up/down balance).
| Parameter | Default | Description |
|---|---|---|
class | modResource | class_key of objects in the selection |
period | all | Period: day, week, month, year, all |
limit | 10 | Maximum items |
context | (empty) | Context filter |
tpl | tpl.Reactions.top | Chunk for one list row |
toPlaceholder | (empty) | Placeholder name instead of direct output |
| Placeholder | Description |
|---|---|
[[+idx]] | Row number |
[[+object_id]] | Object ID |
[[+class_key]] | Object class (in the DB: object_class) |
[[+pagetitle]] | Resource title / product name |
[[+uri]] | Object URL (or empty) |
[[+likes]] | Like count |
[[+dislikes]] | Dislike count |
[[+total]] | Sum of all reactions |
[[+rating]] | Rating (likes − dislikes) |
[[+trending_score]] | Trending score |
Sorted by rating (= likes − dislikes). Same periods as TopLiked: day / week / month / year / all.
<ul class="reactions-top">
[[!TopRated?
&class=`modResource`
&period=`week`
&limit=`5`
]]
</ul><ul class="reactions-top">
{'!TopRated' | snippet : [
'class' => 'modResource',
'period' => 'week',
'limit' => 5,
]}
</ul>[[!TopRated? &period=`month` &limit=`10`]]
[[!TopRated? &period=`year` &limit=`10`]]{'!TopRated' | snippet : ['period' => 'month', 'limit' => 10]}
{'!TopRated' | snippet : ['period' => 'year', 'limit' => 10]}<ul class="reactions-top">
[[!TopRated?
&class=`msProduct`
&period=`year`
&limit=`8`
]]
</ul><ul class="reactions-top">
{'!TopRated' | snippet : [
'class' => 'msProduct',
'period' => 'year',
'limit' => 8,
]}
</ul>[[!TopRated?
&period=`all`
&limit=`3`
&tpl=`myTopRatedRow`
&toPlaceholder=`rx.rated`
]]
<ul class="reactions-top">[[+rx.rated]]</ul>{'!TopRated' | snippet : [
'period' => 'all',
'limit' => 3,
'tpl' => 'myTopRatedRow',
'toPlaceholder' => 'rx.rated',
]}
<ul class="reactions-top">{$_modx->getPlaceholder('rx.rated')}</ul>web context [[!TopRated? &period=`all` &context=`web` &limit=`20`]]Not verified on MODX 3:
[[!TopRated? &class=`TicketComment` &period=`week` &limit=`3`]]| Snippet | Sort | When to use |
|---|---|---|
TopLiked | By likes | “Most popular”: many positive reactions |
TopRated | By rating | “Best”: high like/dislike balance |
An article with 100 likes and 95 dislikes ranks in TopLiked but not in TopRated.