x
 
Create New Page

Revision: Comments on Index

Revision from: 21:50, 18 Aug 2006

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.

You can combine this with some javascript to Show or Hide Comments on Main Page the comments.

To get comments into your RSS feed, see RSS Comments

Source, Thread

Category:Templates Category:Comments

Categories: