Last active
March 26, 2017 20:31
-
-
Save antk25/b3286a6b439214680999af8c82d252a3 to your computer and use it in GitHub Desktop.
1. Сортировка статей по количеству просмотров с использованием сниппета pdoResource из библиотеки pdoTools
2. Тоже самое, только для фильтра mFilter2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[[!pdoResources? | |
&parents=`0` | |
&limit=`0` | |
&loadModels=`sitestatistics` | |
&tpl=`@INLINE [[+id]]. [[+pagetitle]] - [[+views]]` | |
&leftJoin=`{ | |
"Statistics": { | |
"class": "PageStatistics", | |
"on": "modResource.id = Statistics.rid" | |
} | |
}` | |
&select=`{ | |
"modResource": "*", | |
"Statistics": "IFNULL(SUM(views),0) as views" | |
}` | |
&groupby=`modResource.id` | |
&sortby=`views` | |
]] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[[!mFilter2? | |
&class=`msProduct` | |
&element=`msProducts` | |
&loadModels=`sitestatistics` | |
&leftJoin=`{ | |
"Statistics":{"class":"PageStatistics","on":"msProduct.id=Statistics.rid"} | |
}` | |
&select=`{ | |
"msProduct":"*", | |
"Statistics":"IFNULL(SUM(views),0) as views" | |
}` | |
&groupby=`msProduct.id` | |
&sortby=`views` | |
]] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment