I would like user comments on paged threads on my site to be numbered in the following way:

#1, #2, #3, ....., #last comment

I managed to sequentially number comments in every page of one one thread on multiples pages. So every comment on a page has its number, which is one more than number of the previous comment. But unfortunately my code does not continue the sequence on the second page, but starts count from 1 again. Can you please explain how to make comments of one thread to be numbered sequentially. I hope I managed to explain what I want.

Comments

reswild’s picture

Can you post the code you have written so far?

nevets’s picture

If you look at the URL for the second page of comments it will have something like page=10 so that tells you what page you are on. That along with the number of comments per page should allow you to get the correc starting point, something like

$page = $_GET['page'];
if ( ! $page ) {
  $page = 0;
}
$comments_per_page = _comment_get_display_setting('comments_per_page');

$index_start = ( $page * $comments_per_page ) + 1;

If page is not the right name for the query parameter, change $_GET['page'] to reflect the correct name.

yngens’s picture

nevets, thanx! works perfectly. the only thing i needed to change in your code was '1' to '$id' in last line. so final code looks like:


 $page = $_GET['page'];
if ( ! $page ) {
  $page = 0;
}
$comments_per_page = _comment_get_display_setting('comments_per_page');

$index_start = ( $page * $comments_per_page ) + $id;

jmai’s picture

I wonder where I would insert this code into the comment.module to add this feature?

ricabrantes’s picture

Status: Active » Closed (fixed)

No activity, Closed..