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.

Backspace variable in comments?

May 18, 2011 3:11pm

Subscribe [3]
  • #1 / May 18, 2011 3:11pm

    helbnt

    143 posts

    Howdy again!

    I’ve done some searching around, but I can’t seem to find a way to do any sort of backspacing in the comments tag. I looked in the documentation, and while you can in Channel Entries tag, it doesn’t seem to be available in the Comments Entries. Is this the case? If it’s not available, is there a reasoning behind it? Seems natural to me that something like that would be included, so if you have a separator between your comments, the last entry doesn’t have that bottom separator.

    Thanks again!

  • #2 / May 19, 2011 5:44am

    John Henry Donovan

    12339 posts

    helbnt,

    You are welcome to make a feature request but I don’t think it is needed. A simple conditional should do it for you

    {exp:comment:entries sort="asc" limit="20"}
    
    {comment}
    
    By {name} on {comment_date format="%Y %m %d"}
    
    {if count != "{total_results}"}
    <hr>
    {/if}
    
    {/exp:comment:entries}
  • #3 / May 19, 2011 11:44am

    helbnt

    143 posts

    John, that worked beautifully. Thanks much!

    If you have the time, can you explain how that works? I’m trying to follow it - if the comment count does not equal the total results, add the HR tag? I’m confused 😊

    But regardless, if you’re too busy, please feel free to close this out. Thanks again!

  • #4 / May 19, 2011 11:57am

    Mark Bowen

    12637 posts

    Basically if the current count is not equal to the total results (in other words less than it) show the horizontal rule. So :

    Entry 1 (Count 1)
    Entry 2 (Count 2)
    Entry 3 (Count 3)
    Entry 4 (Count 4)
    Total Results = 4

    In the example above the first three entries would not be equal to the amount of total_results so the rule shows. On the fourth entry though the count for that entry and total_results are the same so the rule isn’t shown as the conditional says if not equal to.

    Best wishes,

    Mark

  • #5 / May 19, 2011 12:10pm

    helbnt

    143 posts

    Beautifully explained. Makes perfect sense now. Thanks Mark.

  • #6 / May 19, 2011 12:13pm

    Mark Bowen

    12637 posts

    Beautifully explained. Makes perfect sense now. Thanks Mark.

    No problems. Glad that explained it for you. I’m not normally very good at explaining things like that so I’m glad it came across well.

    Best wishes,

    Mark

  • #7 / May 20, 2011 8:50am

    Sue Crocker

    26054 posts

    Thanks for the assist, Mark.

    helbnt - If anything else comes up, please do let us know in a new thread..

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

ExpressionEngine News!

#eecms, #events, #releases