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.

Displaying comments on index/multi entry pages. Does adding pagination break this?

May 25, 2009 1:31pm

Subscribe [2]
  • #1 / May 25, 2009 1:31pm

    justjess

    16 posts

    Hi,

    I am currently able to display comments on the index/category pages of my site by embedding a comments template and passing the weblog and entry id variables as is demonstrated in the wiki.

    My main template contains:

    {embed="includes/homepagecomments"  comment_total="{comment_total}" entry_id="{entry_id}" title="{title}" url_title="{url_title}"}

    My comments template contains:

    {exp:comment:entries weblog="{my_weblog}" limit="20" orderby="date" sort="desc" entry_id="{embed:entry_id}"}
    {url_as_author} said: {comment} <span class="posteddate">on {comment_date format='%m.%d.%y'}</span>
    {/exp:comment:entries}

    However, adding pagination to the mix on the primary template creates erratic results. Should this functionality be possible? Do I need to resort to a direct query in order for it to work?

    Thanks in advance,
    Jess

  • #2 / May 25, 2009 2:57pm

    e-man

    1816 posts

    Yup, pagination messes with displaying comments.

    Have a look at this older thread to give you an idea for a workaround: http://ellislab.com/forums/viewthread/97723/

  • #3 / May 25, 2009 3:16pm

    justjess

    16 posts

    Hey, thanks so much for this quick response! I had seen that thread, so I guess I’ll have to take the query plunge.

    Thanks again,
    Jess

  • #4 / May 25, 2009 3:23pm

    e-man

    1816 posts

    No prob, don’t hesitate to post your code here if/when you run into trouble.

  • #5 / May 26, 2009 10:49am

    justjess

    16 posts

    OK, so I’ve quickly run into trouble 😊

    I am able to get comments using this query:

    <pre><code>{exp:query sql="SELECT * FROM exp_comments where entry_id='{embed:entry_id}’”}
    {url_as_author} {url} {name} said: {comment} on {comment_date format='%m.%d.%y'}
    {/exp:query}<pre><code>

    First - {url_as_author} does not work. I added in {url} and {name} as tests, so I suppose I can just create the link a different way.

    Second - this query replicates the strange pagination behavior. I am guessing this is because I start out with a conditional that tests for {comment_total} from the parent template. (These are hide/show comment boxes in hidden divs. They only appear if a comment exists, thus the conditional).

    Would you recommend that I instead test for {total_comments}? I tried adding it in, but it doesn’t seem to work either?

  • #6 / May 26, 2009 10:53am

    e-man

    1816 posts

    Care to post a link or show your complete template code, not just the embed?

  • #7 / May 26, 2009 11:46am

    justjess

    16 posts

    yes to both. link is here:

    http://jaypremack.net/index.php?/jpw/indexrev/

    main template

    
    
    

    thanks so much for the continued support - this is a beast!

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

ExpressionEngine News!

#eecms, #events, #releases