Weever, an ExpressionEngine add-on by Studio625

Sample Comment Reply Page

Let's say you have followed the instructions in "A Sample Template", and now you need to create a comment form template. This page will feature the comment to which the user is replying, along with a comment form. Here is a simple example of how you might do that.

First, we need to be sure the parent comment's comment_id is present in one of the URL segments. The sample template did this like so:

<a href="/blog/comment-form/{entry_id}/{comment_id}/">Reply to this comment</a>

In that example, the parent's comment_id is in segment 4. At the top of the page we will display the comment:

<:h1>Replying to:</h1>
<div id="comments">
  {exp:weever}
  {exp:comment:entries weblog="blog" weever="on" comment_id="{segment_4}"}
  <div class="head">
    <p class="title">
      {title}
    </p>
    <p class="meta">
      Posted by: {author} on {comment_date format="%Y %m %d"}
    </p>
  </div> <!-- END .head -->
  <div class="body">
    {comment}
  </div> <!-- END .body -->
  {/exp:comment:entries}
  {/exp:weever}
</div> <!-- END #comments -->

  Below that, we will display the comment form:

<h1>Your reply:</h1>
{exp:comment:form entry_id="{segment_3}"}
<input type="hidden" name="weever-parent-id" value="{segment_4}" />

<p>
  Name:<br />
  <input type="text" name="name" value="{name}" size="50" />
</p>
<p>
  Email:<br />
  <input type="text" name="email" value="{email}" size="50" />
</p>


<p>
  <textarea name="comment" cols="50" rows="12">{comment}</textarea>
</p>


  <p><input type="checkbox" name="save_info" value="yes" {save_info} /> Remember my personal information</p>


<p>
  <label for="title">Comment Title</label>
  <input type="text" name="title" />
</p>

<input type="submit" name="submit" value="Submit" />
<input type="submit" name="preview" value="Preview" />
{/exp:comment:form}

Which might render like this:

Replying to:

That was the most insightful

Posted by: Sally on 2008 01 01

That was the most insightful blog post I have ever read. You are brilliant.

Your reply: