Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Displaying Total number of views and Discussions

edited October 2011 in Vanilla 2.0 - 2.8
In my vanilla forum installation, I would like to show the grand total of all the discussions and views. How can I do that?

Best Answer

  • x00x00 MVP
    Answer ✓
    Probably something like

    $TotalCount = Gdn::SQL()->Select('SUM(CountViews) As Total')->From('Discussion')->Value('Total');

    Then you have to decide where you are going to want to put it.

    grep is your friend.

Answers

  • x00x00 MVP
    Answer ✓
    Probably something like

    $TotalCount = Gdn::SQL()->Select('SUM(CountViews) As Total')->From('Discussion')->Value('Total');

    Then you have to decide where you are going to want to put it.

    grep is your friend.

  • x00x00 MVP
    edited October 2011
    Though probably you are going to need a denormalised version, becuase if you have many records it is going to be a quite an overhead to look it up every time.

    grep is your friend.

  • how would you do that with total members?

    would the above example be < php echo xxxxxx ? > or just that line?

    whats denormalised?
Sign In or Register to comment.