Forum Discussion

Puljac's avatar
Puljac
Maven
11 years ago

Custom count

Hi is there a way to call data from community.

 

I want to make a custom component that will show:

 

- how many overall TOPICS are in community

- how many overall POSTS (messages) are in community

- how many new posts in 24 hours are posted in community

 

thanks.

  • Inactive User's avatar
    Inactive User
    11 years ago

    In Freemarker, that'd be:

     

    <#assign messages = rest("topics/count").value />
    ... 

     

    • Inactive User's avatar
      Inactive User

      In Freemarker, that'd be:

       

      <#assign messages = rest("topics/count").value />
      ... 

       

    • Puljac's avatar
      Puljac
      Maven

      Thank you Inactive User that was exactly what i was looking for....

       

       

      • luk's avatar
        luk
        Boss
        Puljac, how did you solve the 24 hour one?

        "how many new posts in 24 hours are posted in community"

        I did that with v2 API, but the count doesn't seem to be correct... basically I just want the posts of the current day...

        <#local today = .now?string["yyyy-MM-dd"] + "T00:00:00-00:01" />
        <#local query = "SELECT count(*) FROM messages WHERE depth = 0 AND post_time > " + today />