Viewing word count for topics in phpBB3

Question: you want to be able to see the word count for each post in phpBB3. How do you do that?

Answer: You need to edit two files in the phpBB3 code to get this to work. Read on.

We need to set up a variable called MESSAGE_ROW_COUNT, and display that in the template.

First of all, open /<phpbb3>/viewtopic.php and go to near line 1401. This is where the $postrow array is created.


      $postrow = array(
         // more code setting up $postrow elements
      );

Somewhere in the middle, add this additional element:


                'MESSAGE_WORD_COUNT'                    => str_word_count($message),

Then go to /styles/prosilver/template/ and go to line 189, and add this line:


     <!-- IF postrow.POSTER_POSTS != '' --><dd><strong>Word Count:</strong> {postrow.MESSAGE_WORD_COUNT}</dd><!-- ENDIF -->

I put this in line 189, where it is just below the name and details of the person who posted the article. However, you may prefer to put it somewhere else.

0 Responses to “Viewing word count for topics in phpBB3”



  1. No Comments Yet

Leave a Reply




Blog Stats

  • 3,538 hits

My Work Blog

This is my code blog, where I post any interesting code I develop during the course of my work. My research blog is on Blogger, and that is where I update the course of my research work at Columbia University. Blogger's source code formatting is not up to par, but Wordpress' is excellent, which is why my code is being posted on this blog.