[vengeance]
10-31-2009, 05:24 PM
Hello.
I'm creating a quote-message function. I want to quote a message, and if another person quotes me, it adds all those extra quotes all-in-one.
Quoting one message works - however, when there's more, the bbcode doesn't work.
Example:
User 1 said:
User 2 said:
Bla bla
True!
Fail!
But when it's displayed, it only turns one pair of into a plain grey box with text, and the others remain as text "[ quote]" and "[/ quote]".
I hope that made any sense.
My BBcode script is as follows:
<?php
function bbcode($text){
$find = array(
"'\[quote](.*?)\[/quote\]'is"
);
$replace = array(
"<div style=\"border: 1px solid #000000; background: #F2F2F2;\"><div style=\"padding: 3px;\">\\1</div></div>"
);
$text = preg_replace($find,$replace,$text);
return $text;
}
?>
Also to mention, I'm not that great/familiar with regex yet.
I'm creating a quote-message function. I want to quote a message, and if another person quotes me, it adds all those extra quotes all-in-one.
Quoting one message works - however, when there's more, the bbcode doesn't work.
Example:
User 1 said:
User 2 said:
Bla bla
True!
Fail!
But when it's displayed, it only turns one pair of into a plain grey box with text, and the others remain as text "[ quote]" and "[/ quote]".
I hope that made any sense.
My BBcode script is as follows:
<?php
function bbcode($text){
$find = array(
"'\[quote](.*?)\[/quote\]'is"
);
$replace = array(
"<div style=\"border: 1px solid #000000; background: #F2F2F2;\"><div style=\"padding: 3px;\">\\1</div></div>"
);
$text = preg_replace($find,$replace,$text);
return $text;
}
?>
Also to mention, I'm not that great/familiar with regex yet.