Community & Support

How to show sequential number in comments?

I'd like to add a secuential number in my comments since it helps a lot the answers, citations, etc...

In my custom comment theme I used:

<?php
 
echo $id;
?>

and it works partially. The problem appears when you navigate to the second, third... page of comments; the first comment of each page will be again the #1 and so on.

You can see an example here: http://www.pixelgordo.com/forum/nuevo-tema-para-el-foro?page=1

Is there any workaround to this?

Thanks in advance.

Comments

subscribe

subscribe

http://basicmagic.net
drupal samurai for hire
buffalo, new york usa

use the "page" variable in

use the "page" variable in the url:

<?php
 
echo $id + ($_GET['page'] * 50);
?>

"50" is the number of comments per page. change it to whatever number is appropriate

- Corey

comment number

I'm not sure if this is what you're referring to, but you should be able to use the variable values of page number and items per page to number each comment. For example, if you are outputting 25 items per page, the first page of comments would be numbered from 1-25, the second from 26-50 and so on. You'll need to create a custom comment theme to include the comment number.

That works perfectly, thanks

That works perfectly, thank you, coreyp_1.

Bacteria Man, I just know very few things about php, wich variables are you mentioning exactly? I looked up the comment variables and I didn't found anything.

...help Drupal grow, whatever you do matters.

comment.tpl.php

I not completely sure, but it's possible a comment counter property is contained in the comment object. You'll have to do some digging. Try outputting the comment object in the comment.tpl.php template.

nobody click here