View previous topic :: View next topic |
Author |
Message |
GamerZ
Joined: 15 May 2002 Posts: 537 Location: Singapore
|
Posted: Wed Jan 29, 2003 2:13 pm Post subject: [Help] Quoting Comments |
|
|
Anyone would like to co-develop a comments quoting feature in b2? I got the so called base code, but it is so buggy, need lots of help from you all to make it bug free.
Here is the "base" code:
Open b2vars.php, find
Code: | $b2_bbcode['in'] = array( |
add in below it
Code: | '#\[quote](.+?)\[/quote]#is' |
find
Code: | $b2_bbcode['out'] = array( |
add in below it
Code: | '<blockquote>$1</blockquote>', |
_________________
++ GamerZ.Per.Sg - Complex Simplicity
Last edited by GamerZ on Wed Jan 29, 2003 2:24 pm; edited 2 times in total |
|
Back to top |
|
 |
GamerZ
Joined: 15 May 2002 Posts: 537 Location: Singapore
|
Posted: Wed Jan 29, 2003 2:19 pm Post subject: |
|
|
Add in this javascript anywhere in your page
Code: |
<script language="Javascript">
function QuoteComment(cid){
var Comment_Author = document.getElementById("Comment_Author_" + cid).innerText;
var Comment_Text = document.getElementById("Comment_Text_" + cid).innerText;
commentsform.comment.value = commentsform.comment.value + "[quote][b]" + Comment_Author + " said...[/b]\n" + Comment_Text + "[/quote]";
}
</script>
|
next open b2comments.php
find
Code: | <?php comment_author() ?> |
replace
Code: | <span id="Comment_Author_<?php comment_ID() ?>"><?php comment_author() ?></span> |
find
Code: | <?php comment_text() ?> |
replace
Code: | <span id="Comment_Text_<?php comment_ID() ?>"><?php comment_text() ?></span> |
Next add in a "Quote" anywhere within the b2 loop. Here is the code Code: |
<a href="#Quote_This_Comment" onClick="QuoteComment(<?php comment_ID() ?>);">Quote</a> |
_________________
++ GamerZ.Per.Sg - Complex Simplicity |
|
Back to top |
|
 |
GamerZ
Joined: 15 May 2002 Posts: 537 Location: Singapore
|
Posted: Wed Jan 29, 2003 2:20 pm Post subject: |
|
|
this code is definately not complete, don't use it unless you want to help out in the coding of it.
This code works only with 1 quote, and it cannot work with "a quote in a quote".
Thanks, any help is appreciated  _________________
++ GamerZ.Per.Sg - Complex Simplicity |
|
Back to top |
|
 |
Cyberian75
Joined: 26 Sep 2002 Posts: 1019 Location: Oregon
|
Posted: Wed Jan 29, 2003 5:54 pm Post subject: |
|
|
I believe my "latest n comments" does something very similar to what you are trying to do. Yeah? _________________ Michael P. |
|
Back to top |
|
 |
GamerZ
Joined: 15 May 2002 Posts: 537 Location: Singapore
|
Posted: Thu Jan 30, 2003 6:42 am Post subject: |
|
|
hmm, but mine is trying to quote a comments w/o the implementation of my sql queries. _________________
++ GamerZ.Per.Sg - Complex Simplicity |
|
Back to top |
|
 |
|