Keyword

Guide: How to add BB Functionality to K2 Comment System

  • Massoud
  • Massoud's Avatar Topic Author
  • Offline
  • Junior Member
More
13 years 2 months ago #98649 by Massoud
at the end I find a solution to add BBCodes in K2 Comment System here is the instruction:

 

1. download and install and enable plugins yvBBcode:

extensions.joomla.org/extensions/style-a-design/typography/3326

version 1.x is for joomla 1.5 and version 2.x is for joomla 1.6

 

 

2. open the item_comments_form.php inside of your k2 template directory:

insert this code in line 19 after <?php endif; ?>

 

&lt;div class="yvBBCodeForm"&gt;&lt;a onclick="yvBBCodeReplaceText(document.forms.commentform.commentText, 'b');" href="javascript:void(0);"&gt;&lt;img alt="Bold" src="http://localhost:85/zoomit/plugins/system/yvbbcode/editor/images/bold.gif"&gt;&lt;/a&gt;&lt;a onclick="yvBBCodeReplaceText(document.forms.commentform.commentText, 'i');" href="javascript:void(0);"><img alt="Italic" src="http://localhost:85/zoomit/plugins/system/yvbbcode/editor/images/italic.gif"&gt;&lt;/a&gt;&lt;a onclick="yvBBCodeReplaceText(document.forms.commentform.commentText, 'u');" href="javascript:void(0);"><img alt="Underline" src="http://localhost:85/zoomit/plugins/system/yvbbcode/editor/images/under.gif"&gt;&lt;/a&gt;&lt;a onclick="yvBBCodeReplaceText(document.forms.commentform.commentText, 's');" href="javascript:void(0);"><img alt="Strikethrough" src="http://localhost:85/zoomit/plugins/system/yvbbcode/editor/images/strike.gif"&gt;&lt;/a&gt;&lt;a onclick="yvBBCodeReplaceText(document.forms.commentform.commentText, 'sub');" href="javascript:void(0);"><img alt="Subscript" src="http://localhost:85/zoomit/plugins/system/yvbbcode/editor/images/sub.gif"&gt;&lt;/a&gt;&lt;a onclick="yvBBCodeReplaceText(document.forms.commentform.commentText, 'sup');" href="javascript:void(0);"><img alt="Superscript" src="http://localhost:85/zoomit/plugins/system/yvbbcode/editor/images/sup.gif"&gt;&lt;/a&gt;&lt;a onclick="yvBBCodeReplaceText(document.forms.commentform.commentText, 'email');" href="javascript:void(0);"><img alt="Email" src="http://localhost:85/zoomit/plugins/system/yvbbcode/editor/images/email.gif"&gt;&lt;/a&gt;&lt;a onclick="yvBBCodeReplaceText(document.forms.commentform.commentText, 'img');" href="javascript:void(0);"><img alt="Image" src="http://localhost:85/zoomit/plugins/system/yvbbcode/editor/images/img.gif"&gt;&lt;/a&gt;&lt;a onclick="yvBBCodeReplaceText(document.forms.commentform.commentText, 'url');" href="javascript:void(0);"><img alt="Hyperlink" src="http://localhost:85/zoomit/plugins/system/yvbbcode/editor/images/url.gif"&gt;&lt;/a&gt;&lt;a onclick="yvBBCodeReplaceText(document.forms.commentform.commentText, 'list');" href="javascript:void(0);"><img alt="Ordered list" src="http://localhost:85/zoomit/plugins/system/yvbbcode/editor/images/list.gif"&gt;&lt;/a&gt;&lt;a onclick="yvBBCodeReplaceText(document.forms.commentform.commentText, 'ulist');" href="javascript:void(0);"><img alt="Unordered list" src="http://localhost:85/zoomit/plugins/system/yvbbcode/editor/images/ulist.gif"&gt;&lt;/a&gt;&lt;a onclick="yvBBCodeReplaceText(document.forms.commentform.commentText, 'quote');" href="javascript:void(0);"><img alt="Quote" src="http://localhost:85/zoomit/plugins/system/yvbbcode/editor/images/quote.gif"&gt;&lt;/a&gt;&lt;a onclick="yvBBCodeReplaceText(document.forms.commentform.commentText, 'code');" href="javascript:void(0);"><img alt="Code" src="http://localhost:85/zoomit/plugins/system/yvbbcode/editor/images/code.gif"&gt;&lt;/a&gt;&lt;/div&gt;

 


3. Rename all of the comment-form to commentform in item_comments_form.php

4. open K2.Js file under com_k2/js directory and replace all of "comment-form" to "commentform"

 

it has one problem and that's it does not work properly when text selected I hope someone can fix this, I'm working on the yvbbcode javascript to find the problem

 

NOW I want to know is there anyone can help us to add a loading just after user click on submit buttom because it takes a second to submit the comment and refresh the page, during this delay user thinks the button did not work and try to reclick on it and it makes to submit a comment more that onec.

Please Log in or Create an account to join the conversation.

More
13 years 2 months ago #98650 by william white
I get duplicate comments in the k2 comments for this same reason....

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum