Forum Discussion

vishwajeet_hol's avatar
10 years ago

Sort the posts by the number of views to that topic

Hi,   I am trying to sort posts by no. of views.   Just tried below code by referering one of the post on lithosphere, but it doesn't works : http://community.lithium.com/t5/Developers-Discussio...
  • VarunGrazitti's avatar
    10 years ago

    vishwajeet_hol Updated your code a bit, see if this works

     

    <#assign thread_list=rest("/boards/id/<board_ID>/threads").threads/>
    <ul>
    <#list thread_list.thread?sort_by(['messages','topic','views','count'])?reverse as thread>
    <li>${thread.id}</li>
    </#list>
    </ul>