Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2008-05-27 23:25:52

Egypt Urnash
Archived Plugin Author
From: Boston
Registered: 2006-07-23
Posts: 19
Website

Re: [plugin] [ORPHAN] peg_nested_comments

Yeah, the docs are a mess because the plugin I wrote this on top of had screwed-up docs and I never got around to cleaning them up.

I was planning to replace the Javascript that I inherited from cha_comment_reply to make a new reply form appear beneath the comment you’re replying to, but I’ve been caught up in a major art project with no time for coding. Feel free to run it through a decompressor and enhance it, if you have the skills!

Things to do to get it working:

  • make sure that you’re using <txp:peg_nested_comments /> instead of <txp:comments ?>
  • make sure that your form for displaying a comment includes a call to <txp:peg_child_comments /> somewhere in it. This is the heart of how this plugin works.
  • make sure that your comments are being displayed in a UL or OL, not in some other method
  • make sure that your css isn’t killing the left margins of children of lists

Last edited by Egypt Urnash (2008-05-28 12:34:19)

Offline

#14 2008-05-28 04:47:28

WebKat
Member
Registered: 2007-01-16
Posts: 301

Re: [plugin] [ORPHAN] peg_nested_comments

I don’t have the skills. Like you, I am an artist … but I’m not a programmer. I can do HTML and that’s about it. Anyway I know all about getting caught up in art projects!

make sure that your comments are being displayed in a UL or OL, not in some other method
This may be where I’m having trouble. It has been a long time since I was deep enough in my code to remember how everything is, but looking at the html that is produced on a commented page, I don’t see any list tags. What form is it and can you give me a generic example?



WebKat

Offline

#15 2008-05-28 12:41:00

Egypt Urnash
Archived Plugin Author
From: Boston
Registered: 2006-07-23
Posts: 19
Website

Re: [plugin] [ORPHAN] peg_nested_comments

It’s the “comments” form. Here’s an example, pulled from my templates:

<div class="header <txp:comment_name link="0" />"><txp:glx_gravatar class="userpic" />
	<span class="admin">
		<txp:comment_permlink>◉</txp:comment_permlink>
	</span>
	<txp:comment_name link="1" /><br /><txp:hide><txp:comment_time format="l, g:i A" /><br /><txp:comment_time format="F js, Y" /></txp:hide><txp:comment_time />
	<span class="commentlinks"><txp:peg_reply_link /></span>
</div>
<div class="body <txp:comment_name link="0" />">
<txp:comment_message />
</div>
<txp:peg_child_comments wraptag="ul" />

And the call to <txp:peg_nested_comments> is in the "comments_display" form. <txp:peg_comments wraptag="ul" /> is what I have.

Offline

#16 2008-05-28 13:57:53

WebKat
Member
Registered: 2007-01-16
Posts: 301

Re: [plugin] [ORPHAN] peg_nested_comments

Ok here are my forms now (still not working)…

comments:

<txp:zem_prblock><div class="<txp:sed_get_comment_class />">
<txp:comment_anchor />
<h5><span class="comment-no"><txp:comment_permlink> #<txp:sed_comment_number/></txp:comment_permlink></span> &middot;&nbsp;<txp:comment_name link="0" /><txp:sed_if_author_comment_string string=" (Author)" /></h5>
<txp:sed_comment_time class="comment-time" />
<txp:message /><txp:peg_reply_link /></div><txp:peg_child_comments wraptag="ul/>
</txp:zem_prblock>

comments_display:

<div id="ribbon-ends"><img src="/images/nav/ribbon-left.png" /></div>
<div id="ribbon"><h3 id="comment"><txp:comments_invite textonly="1" showalways="1" showcount="0" /></h3></div>
<div id="ribbon-ends"><img src="/images/nav/ribbon-right.png" /></div><br clear="all" />
<txp:peg_comments wraptag="ul" />
<txp:peg_nested_comments wraptag="ul" />
<txp:if_comments_preview>
<div id="cpreview">
<txp:comments_preview />
</div>
</txp:if_comments_preview>
<txp:if_comments_allowed>
<txp:comments_form />
<txp:else />
<p><txp:text item="comments_closed" /></p>
</txp:if_comments_allowed>

and here is an example of the source when I view a comment that’s been posted:

<div class="comment even author">
<a id="c000445"></a>
<h5><span class="comment-no"><a href="http://opalcat.com/Creative_Writing/on-cats-and-trust#c000445"> #4</a></span> ·&nbsp;OpalCat<span class="author-string"> (Author)</span></h5>
<span class="comment-time">05/27/2008 03:40 PM</span>
	<p>nesting test</p>
<a class="peg_replyto" href="#peg_replyto" onclick="peg_selectComment('000445');"> Reply </a></div>

I don’t understand why it’s wrapping with a p …



WebKat

Offline

#17 2008-05-28 23:06:50

Egypt Urnash
Archived Plugin Author
From: Boston
Registered: 2006-07-23
Posts: 19
Website

Re: [plugin] [ORPHAN] peg_nested_comments

Hmm. Well, first, there’s no such tag as <txp:peg_comments>. So getting rid of that is a start.

Kill the css that hides the reply-to field and make sure it’s getting filled in when you reply to a comment.

(Do you have this live? I might be able to take a look at it.)

You shouldn’t see anything special in a comment that doesn’t have children.

You should be seeing something like this when you view a comment with a child comment:

<div class="comment even author">
<a id="c000445"></a>
<h5><span class="comment-no"><a href="http://opalcat.com/Creative_Writing/on-cats-and-trust#c000445"> #4</a></span> ·&nbsp;OpalCat<span class="author-string"> (Author)</span></h5>
<span class="comment-time">05/27/2008 03:40 PM</span>
	<p>nesting test</p>
<a class="peg_replyto" href="#peg_replyto" onclick="peg_selectComment('000445');"> Reply </a>
<ul>
<div class="comment odd author">
<a id="c000446"></a>
<h5><span class="comment-no"><a href="http://opalcat.com/Creative_Writing/on-cats-and-trust#c000446"> #4</a></span> ·&nbsp;OpalCat<span class="author-string"> (Author)</span></h5>
<span class="comment-time">05/27/2008 03:45 PM</span>
	<p>nesting test</p>
<a class="peg_replyto" href="#peg_replyto" onclick="peg_selectComment('000446');"> Reply </a>
</ul></div>

</div>

Offline

#18 2008-05-29 03:29:53

WebKat
Member
Registered: 2007-01-16
Posts: 301

Re: [plugin] [ORPHAN] peg_nested_comments

It’s live on every article page on my site. I’ve done a test where I replied to a comment, then replied to that comment, then replied to that comment, etc, here … it all just shows up in the nested order, but flush left with no indent (sorry it’s such a bummer of an article, it just happened to be what my most recent one was.).
The reply-to field is getting filled in—I saw that it was before I hid it, but I removed the hidden css to double check and it was fine. It behaves the exact same way whether it is hidden or not.

And I’m confused now because the original post in this thread says:

replace <txp:comments /> in your comments_display form with <txp:peg_comments /> – it takes the same syntax.


WebKat

Offline

#19 2008-05-29 13:42:37

Egypt Urnash
Archived Plugin Author
From: Boston
Registered: 2006-07-23
Posts: 19
Website

Re: [plugin] [ORPHAN] peg_nested_comments

I’m not sure why it’s wrapping the child comments in a div, instead of a ul. Very weird. Oh, wait. I see now. Close your quotes in the comment form: <txp:peg_child_comments wraptag= “ul />

If that doesn’t work, you can work around this by doing this:

add some css along the lines of
.comment .comment {margin-left:2em}

and change
</div><txp:peg_child_comments wraptag=“ul/>
to
<txp:peg_child_comments wraptag=“ul/></div>

Also, ignore the part above where I talk about peg_nested_comments as I appear to have been smoking crack when I wrote that; I just looked through the source of the plugin and there’s no tag by that name. Sorry, it’s been quite a while since I hacked this up!

Last edited by Egypt Urnash (2008-05-29 13:43:03)

Offline

#20 2008-05-29 18:38:35

WebKat
Member
Registered: 2007-01-16
Posts: 301

Re: [plugin] [ORPHAN] peg_nested_comments

Yeah that crack smoking can mess with your code for sure ;)

I fixed the missing quote, added the css you suggested, moved the div, changed the comments tag back to the tag that actually exists…

…still not working :(



WebKat

Offline

#21 2008-05-31 02:33:31

Egypt Urnash
Archived Plugin Author
From: Boston
Registered: 2006-07-23
Posts: 19
Website

Re: [plugin] [ORPHAN] peg_nested_comments

Hmm, it looks like they’re not nested in the source at all right now. Try this in your comment template:

<txp:zem_prblock><div class="<txp:sed_get_comment_class />">
<txp:comment_anchor />
<h5><span class="comment-no"><txp:comment_permlink> #<txp:sed_comment_number/></txp:comment_permlink></span> &middot;&nbsp;<txp:comment_name link="0" /><txp:sed_if_author_comment_string string=" (Author)" /></h5>
<txp:sed_comment_time class="comment-time" />
<txp:message /><txp:peg_reply_link /><txp:peg_child_comments wraptag="ul"/></div>
</txp:zem_prblock>

Offline

#22 2008-05-31 05:01:39

WebKat
Member
Registered: 2007-01-16
Posts: 301

Re: [plugin] [ORPHAN] peg_nested_comments

Ok I did that… looks the same… :(



WebKat

Offline

#23 2008-05-31 14:30:02

WebKat
Member
Registered: 2007-01-16
Posts: 301

Re: [plugin] [ORPHAN] peg_nested_comments

I changed my comment form again because it was unclear what was what how it was before. Here is my new code:

<table width="100%"  border="0" cellspacing="0" >
  <tr bgcolor="#F8EBCD">
  	<td width="40" bgcolor="#F8EBCD"><txp:glx_gravatar size="40" default="http://opalcat.com/images/pixel.gif" rating="PG" class="gravatar" /></td>
    <td bgcolor="#F8EBCD"><txp:comment_anchor /><strong><span class="comment-no"><txp:comment_permlink> #<txp:sed_comment_number/></txp:comment_permlink></span> 
&middot;&nbsp;<txp:comment_name link="0" /><txp:sed_if_author_comment_string string=" (Author)" /></strong><br>
<txp:sed_comment_time class="comment-time" />&nbsp;&nbsp;&nbsp;<txp:peg_reply_link /></td>
  </tr>
  <tr>
    <td colspan="2"><txp:message /><txp:peg_child_comments wraptag="ul"/></td>
  </tr>
</table>


WebKat

Offline

#24 2008-05-31 15:34:01

Egypt Urnash
Archived Plugin Author
From: Boston
Registered: 2006-07-23
Posts: 19
Website

Re: [plugin] [ORPHAN] peg_nested_comments

Try going to admin->preferences and setting ‘present comments as a numbered list’ to ‘yes’. The docs for the sed_comment pack suggest setting it to ‘no’.

Oddly enough the only way I could reproduce this on my own setup (with your templates) was to say ‘no’ on that and not provide a wraptag to the peg_child_comments – it wasn’t doing this on my txp install if I explicitly said wraptag=“ul”. But on yours that admin pref seems to be overriding that.

Offline

Board footer

Powered by FluxBB