Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to add reply Number in topic.php

  • @singene

    Member

    Hello, this may be just to hard or something… but what I am trying to do is in the topic.php put the reply number in the topic meta.

    Like reply #2 on the second reply and reply #3 on the third and so on

    How can you?

Viewing 16 replies - 1 through 16 (of 16 total)
  • @r-a-y

    Keymaster

    @singene

    Member

    sweet thanks! But, I tried the code, and looks like what big jimmysisco said, it only works on the first page.

    How can you add this to all pages?

    @r-a-y

    Keymaster

    I’ve amended the code on the other forum thread.

    Please post subsequent replies on that thread and not this one to prevent forking.

    Thanks!

    @singene

    Member

    ok, now I got that.

    I’m sort of trying to figure out how to display the number count. Any hints on to get the count? Is it in the $bp->global?

    @r-a-y

    Keymaster

    Try the $topic_template global variable. Particularly $topic_template->current_post.

    @singene

    Member

    I’m not that advanced… :???: <?php topic_template_current_post_ID ?

    @r-a-y

    Keymaster

    `global $topic_template;

    echo $topic_template->current_post;`

    @singene

    Member

    oops sorry, is this “forking?”

    @r-a-y

    Keymaster

    It’s slightly different, so I’ll allow it ;)

    @singene

    Member

    O boy :(, it works great.

    But, now heres the thing. On each page, the count starts back at one. I want it to keep going.

    Sorry, and also, on the second page and so on, it does not count the first post.

    Aaaarg! :)

    @r-a-y

    Keymaster

    Try:

    `function my_not_first_post() {
    global $topic_template;

    $current_page = $topic_template->pag_page – 1;
    $post_position = $current_page * $topic_template->pag_num + $topic_template->current_post;
    if ( 0 != $post_position ) {
    // do your business here… eg.
    echo ‘Re: ‘;
    echo $post_position;
    }

    }`

    @singene

    Member

    Getting there… but now each count is going up by 8, and each page starts at 8. So close!

    Reply #8

    Reply #16

    @r-a-y

    Keymaster

    Amended again!

    @singene

    Member

    Now it starts at 16 on every page, and goes up by 1.

    r-a-y, you’ve helped me so much, if you want some donation or something i’ll do it :)

    @r-a-y

    Keymaster

    Amended again! Should work now as I’ve actually tested it this time ;)

    Donation link is available on my profile page.

    @singene

    Member

    Sweet! Thanks! it works now.

    I will donate tonight, or as soon as i possibly can, I get my pay check tonight. :D

Viewing 16 replies - 1 through 16 (of 16 total)
  • The topic ‘How to add reply Number in topic.php’ is closed to new replies.
Skip to toolbar