This is the archived version of my b2evolution code blog.
If you require any help regarding b2evolution then
visit it's support forums
You can find my current blogs here
Code : {@link : WafflesOn}
Personal : {@link : InnerVisions}
| « Playing with clouds | Playing with nested comments » |
Posted on 11th Mar 2007 in : Plugins & Widgets
I finally found the time to finish off the nested comments plugin. If you fancy having a pre-release play with it you can find it here. Please note : it has a known problem - when you preview a comment it "forgets" which comment it's a reply to. This is caused by the fact that the core redirects through htsrv when creating a preview and doesn't pass on the plugins parameter. I'm working on it
*solved : zip file update 12th March*
Unlike most of our plugins this one also involves some code in your skins _feedback.php, not a lot though so don't worry. First find this segment of code and add the new bit :-
PHP:
<?php | |
$CommentList = & new CommentList( 0, implode(',', $type_list), array('published'), $Item->ID, '', 'ASC' ); | |
<span style="color:red">// Nested comments part 1 of 3</span> | |
<span style="color:red">$Plugins->call_by_code( 'amNestCmnt', array() );</span> |
The next piece of code can go anywhere in the comment loop and will spit out a "reply to this comment" link
PHP:
<?php | |
// Nested comments part 2 of 3 | |
if ( $Item->can_comment( NULL ) ) | |
{ | |
echo '<p class="replyTo"><a href="'.url_add_param( $Item->get_permanent_url(), 'am_nestCmnt_reply_to='.$Comment->ID ).'#bComment_form_id_'.$Item->ID.'">Reply to <span>comment '.$Comment->ID.' by </span>'.$Comment->get_author_name().'</a></p>'; | |
} | |
?> |
The final bit of code is just a demonstration of how to use the comment depth to indent your comments
PHP:
// Nested comments part 3 of 3 | |
<div class="bComment"<span style="color:red"><?php echo ( isset( $Comment->depth ) ? ' style="margin-left:'.( $Comment->depth * 2).'em"' : '' );?></span>> |
And that's pretty much it. The plugin should work in all 1.8.x and 1.9.x versions, let me know if you manage to break it ![]()
¥
Notice: Array to string conversion in /[path]/inc/_core/_misc.funcs.php on line 298
Array
Page archived : 2nd Mar 2010