Forums

[resolved] Display Each Comment Number (6 posts)

  1. cronus3166
    Member
    Posted 3 months ago #

    So I'm working on my comment section, and I have it almost to where I want. But I would like to display next to the author of the comment, the comment number.

    <?php comment_ID();?> would work for most purposes to get what I want across, but if I need to delete a comment, then the numbering gets messed up

    So it could go from 1, 2, 4, 5, 8 (you get the idea)

    Does anyone know the command to keep the count accurate, or a different command to use to display what each comment count is?

    Thanks!

  2. whistler2020
    Member
    Posted 3 months ago #

    my guess is that there is no command. the number probably corresponds to the comment list in the sql database. so you'd need to edit the database directly.

  3. boober
    Member
    Posted 3 months ago #

    in your stylesheet find this

    ol#commentlist {
    list-style:none;
    margin:15px 0 0;
    padding:0;
    }

    and get rid of

    list-style:none;
  4. cronus3166
    Member
    Posted 3 months ago #

    Well I did this, and it works... just not to the degree I was hoping for ^_^

    It shows the number of each comment outside of the div, when I was hoping to have it next to the name of the author and be able to edit it.

    And I know it has to be (somewhat possible), cause I got the idea from the blog.us.playstation.com.

    Although now that I think about it, they may not delete any comments done to their site

    ol#commentlist {
    list-style:none;
    margin:15px 0 0;
    padding:0;
    }

    and get rid of

    list-style:none;

  5. boober
    Member
    Posted 3 months ago #

    well you havent provided a link, so i cant see the issue, but try adding
    list-style-position: inside;

    to get the numbers closer to author name.

    as far as editing them, i have no idea what you mean.

  6. mhsouthpaw
    Member
    Posted 3 months ago #

    The way we did it on the playstation blog is by setting a variable to 1 before the foreach($comments) loop and just echoing and incrementing the variable within the loop.
    Before the loop:

    <?php $cmntCnt = 1; ?>

    Within the loop:

    <?php echo($cmntCnt++); ?>

Reply

You must log in to post.

About this Topic