ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Comment ID number

November 07, 2011 6:29am

Subscribe [3]
  • #1 / Nov 07, 2011 6:29am

    warrenkeith

    29 posts

    I’m trying to number comments based on how many comments are open rather than using {comment_id}, which obviously skips over deleted one and closed ones.

    Anyone any ideas? Any advice appreciated!

  • #2 / Nov 07, 2011 6:55am

    silenz

    1651 posts

    If you mean numbering the comments displayed on the website you could use {count} or or and ordered HTML list.

  • #3 / Nov 07, 2011 6:59am

    warrenkeith

    29 posts

    The trouble is that I’m not displaying them all at once.

    I’m displaying the latest 10 from a list of 50 so I haven’t got anything to count…

  • #4 / Nov 07, 2011 7:28am

    silenz

    1651 posts

    When using pagination you can use {absolute_count}. I see your problem, though, since that does not count backwards.
    So out-of-box there is no way, I think.

  • #5 / Nov 07, 2011 7:34am

    warrenkeith

    29 posts

    Yes I got excited when I saw absolute count until I realised it counted forwards.

    Anyone know how I might reverse this?

  • #6 / Nov 07, 2011 8:36am

    Mark Bowen

    12637 posts

    Hiya,

    Give this a go in your template :

    <?php echo ({total_results} - {count} + 1); ?>

    PHP will need to be turned on for the template and to Output mode but if I’m reading correctly then that should allow you to do what you need here.

    Best wishes,

    Mark

     

  • #7 / Nov 07, 2011 11:41am

    warrenkeith

    29 posts

    Mark, that works great for the number of comments on a given page but do you know any way I can include all comments regardless of pagination?

    Thanks!

  • #8 / Nov 07, 2011 2:34pm

    Mark Bowen

    12637 posts

    Hiya,

    Sorry not quite sure what you meant by the above?

    Do you have an example of what you mean that you could show me?

    Best wishes,

    Mark

  • #9 / Nov 07, 2011 3:09pm

    warrenkeith

    29 posts

    What I’m working on is local and a site that does it doesn’t spring to mind.

    What the snippet you’ve given me provides is perfect for the number of comments that are rendered on the page. What I’m ideally after is the same but for a count of all open comments posted, regardless of how many are rendered on a particular page.

    Does that make sense?

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases