Added this code to my node-blog.tpl.php file to display comments after each blog post on a blog's main page:

    if ( $page == 0 ) {

        print "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
        print "<tr>\n<td width=\"50\">&nbsp;</td>\n";
        print "<td align=\"left\">\n";
        print "<div class=\"content\">" . comment_render($node,0,0) . "</div>\n";
        print "</td>\n</tr>\n</table>\n";
    }

And it works great for displaying the comments, but it broke the pager, which is no longer displayed at the bottom of the page. Any suggestions?

Comments

amnon’s picture

That's because comment_render() uses the same pager main-page uses.

A dirty solution:

1. Examine 'pager.inc' and find out all the global variables it uses to record the pager status. Then, before the call to comment_render(), save them in backup variables. After the call, restore them.

2. To prevent having a possible pager under the comments, temporarily set the comment_default_per_page to some 'infinite' value (like 9999).

swish’s picture

Thanks for the suggestion! Worked like a charm. :)

coolo’s picture

Anyone feel like sharing some more detail on how this approach might work? Or a more step by step description of how to do #1 listed above?

Thanks