Khan Posted January 23, 2013 Share Posted January 23, 2013 Dear PW-ers. I would like to inform you that I’ve been in need of Tree View commenting system for a project being developed by me at the moment, thus, I’ve decided to make some additions to the commenting system developed by Ryan. Hereunder, I’d like to share the code with you for your kind information. You can also practice it in case of need. Some screenshots: Download link: FieldtypeComments.zip List of changed files: Comment.php CommentForm.php CommentList.php FieldtypeComments.module InputfieldCommentsAdmin.module small change in main.css: .CommentForm_reply { display:none; padding:15px; background:#999; } Archive updated. 14 Link to comment Share on other sites More sharing options...
Pete Posted January 23, 2013 Share Posted January 23, 2013 Thanks for this - I know a lot of people have need of threaded comments so this is very welcome 1 Link to comment Share on other sites More sharing options...
Joss Posted January 23, 2013 Share Posted January 23, 2013 Ah, that is exactly what I need (or will need) later this year for something. Nice one! Link to comment Share on other sites More sharing options...
Khan Posted January 24, 2013 Author Share Posted January 24, 2013 There was something wrong with recursion. I have fixed it. 1 Link to comment Share on other sites More sharing options...
ryan Posted January 25, 2013 Share Posted January 25, 2013 Nice job Khan! Perhaps we should integrate this as an option into the main Comments fieldtype? Or should be be a separate fieldtype (under a different name)? 10 Link to comment Share on other sites More sharing options...
biotech Posted January 26, 2013 Share Posted January 26, 2013 Nice job Khan! Perhaps we should integrate this as an option into the main Comments fieldtype?..... This would be a great. Thanks to both of you. Link to comment Share on other sites More sharing options...
teppo Posted January 26, 2013 Share Posted January 26, 2013 +1 for integrating into main comments module as an option. Personally I prefer flat comments (as strange as it may sound, I find these easier to follow, since they're always in the order they've been posted) but I can think of many cases where nested comments would be preferred. Great job @Khan! 1 Link to comment Share on other sites More sharing options...
Khan Posted January 26, 2013 Author Share Posted January 26, 2013 Thanks @ryan, @biotech, @teppo. @ryan, This is only addition for FieldtypeComments. If you have already installed FieldtypeComments you must run this SQL code: ALTER TABLE field_comments ADD COLUMN parent_id int unsigned NOT NULL default '0' @teppo, ideas is not to be seems alike Link to comment Share on other sites More sharing options...
Pete Posted January 26, 2013 Share Posted January 26, 2013 I think it should be an option for the core module. Not that we're trying to compete against other systems in particular, but I know this is how it works for WordPress and on some sites works quite successfully: http://www.rockpapershotgun.com/2013/01/25/bit-by-bit-evoland-lets-you-play-through-gaming-history/#comments Having it in there as an option and maybe enabled on your blog profile by default would be an idea ryan. Link to comment Share on other sites More sharing options...
Joss Posted January 26, 2013 Share Posted January 26, 2013 It is also how things like Disqus work, so it will help those who want that sort of functionality without having to use a third party system. In the Looooonggg term it might be nice to have just the one system, but be able to switch the display - either from the admin or by the user (or both) Link to comment Share on other sites More sharing options...
Khan Posted January 28, 2013 Author Share Posted January 28, 2013 one of users asked me how to do counting comments with reply. for countuin comments with reply do next steps: open /wire/core/FieldtypeMulti.php file and find this 136 line : if (!$this->page->is('admin')) $comment_list = $this->setTree($comment_list); change it to: $this->countWithReply = count($comment_list);if (!$this->page->is('admin')) $comment_list = $this->setTree($comment_list); then in this file add function: public function countWithReply($event) { $event->return = $this->countWithReply; } then in this file add function: public function init() { $this->addHookAfter('Page::countWithReply', $this, 'countWithReply'); } to print result in your template file type this: echo $page->countWithReply(); 3 Link to comment Share on other sites More sharing options...
itsberni Posted June 6, 2014 Share Posted June 6, 2014 Hello Khan, great - this is the feature i was looking for. Little issue. I was replacing the existing files in the wire folder ( folder FieldtypeComments ) with yours. i am running the sql code, because the fieldtypeComments were allready installed. Now several reply-formulars appearing and a javascript - Error is thrown ( $(...) live is not a function ). in the admin eyerthing works fine ( pw 2.4.2 ) Are there any troubles with other modules/javascripts or some mistakes for my part during installation? Many Thanks Link to comment Share on other sites More sharing options...
teppo Posted June 6, 2014 Share Posted June 6, 2014 @itsberni: sounds like you're using jQuery 1.9 (or newer) on your site, with .live() already removed. Backend is still using 1.8.3, which has .live() in place. Possible solutions would be either updating the module JS (replace .live() with .on() and make any other related changes) or using an older version of jQuery in your site's frontend. 1 Link to comment Share on other sites More sharing options...
itsberni Posted June 6, 2014 Share Posted June 6, 2014 @teppo, you´re right! Thanks for the advice! For all jquery 2.11 - users... Change line 101 in the CommentList.php to $('body').on('click', '#close', function(){...}); and pay attention to the css-snippet which will wipe out the additional reply-formular ...solved.... Link to comment Share on other sites More sharing options...
Soma Posted September 30, 2014 Share Posted September 30, 2014 What about this in core? 1 Link to comment Share on other sites More sharing options...
apeisa Posted October 1, 2014 Share Posted October 1, 2014 Shouldn't comments be out of the core actually? 4 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now