Vanilla open source was terminated 1 January 2025 by Higher Logic. See this announcement for more information.

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.