How to show sequential number in comments?

Macarro - August 16, 2008 - 19:33

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.

subscribe

basicmagic.net - August 16, 2008 - 21:12

subscribe

use the "page" variable in

coreyp_1 - August 16, 2008 - 21:26

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

Bacteria Man - August 16, 2008 - 22:11

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

Macarro - August 17, 2008 - 00:18

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.

comment.tpl.php

Bacteria Man - August 17, 2008 - 15:58

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.

 
 

Drupal is a registered trademark of Dries Buytaert.