Be careful when utilizing these instructions, as this can be fairly intensive on your hosting.
Thanks to Lynda for this method.
EE does not natively have the ability to show the comments on “mutli-page” templates. There is a workaround, involving PHP, and is shown below:
First thing you want to do is create a template that will be used for comments only. I’ve named mine “inc_comment”. Change it to fit your needs:
<br /><br />
<b>Comments on this Entry:</b><br /><br />
{exp:comment:entries sort="asc" weblog="weblog1"}
<b>{if url != ""}<a href="{url}">{/if}{name}{if url != ""}</a>{/if} writes:</b><br/>
{comment}
<div align="right"><b>{comment_date format="%m.%d.%y %h:%i %A"}</b></div><br/><br/>
{/exp:comment:entries}
The next thing you want to do is add a call to this comment include in your Index template. In order to do this, you must enable PHP Output in your template preferences. You should place this just before the {/exp:weblog:entries} tag.
<?php @include("{comment_path=template_group/inc_comment}"); ?>
This will call the appropriate comments into the page when it loads.
The same technique can be used on the index page to bring in comments inside your weblog:entries tag.
A more recent approach
Another approach that is more recent takes advantage of the EE embed tag. You send the a weblogs {entry_id} to your embedded comments template.
I’ll provide the following example below:
I use the this code in my homepage template of ‘blog/index’
{exp:weblog:entries weblog="{my_weblog_name}" limit="1" orderby="date" sort="desc" disable="member_data|trackbacks"}
<h2 class="title">{title}</h2>
{summary}
{body}
{embed="page_elements/comments" my_weblog_name="{my_weblog_name}" my_template_group="{my_template_group}" entry_id="{entry_id}"}
{embed="page_elements/_comment_form" my_weblog_name="{my_weblog_name}" my_template_group="{my_template_group}" entry_id="{entry_id}"}
{/exp:weblog:entries}
And this code in my comments <u>partial</u> template of ‘page_elements/comments’
{exp:comment:entries weblog="{embed:my_weblog_name}" entry_id="{embed:entry_id}"}
<hr/>
<div class="comment {switch="odd|even"}">
{comment}
Comment by {url_or_email_as_author} on {comment_date format='%m/%d'} at {comment_date format='%h:%i %A'}
</div>
{/exp:comment:entries}
To get comments into your RSS feed, see RSS Comments
Category:Templates Category:Comments
