Qbasicnews.com

Full Version: bbcode [quote='name']message[/quote] need HELP with this
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
im doing tihs

Code:
eregi_replace("\[quote](.*)[/quote]", "<div class='quote'>//1 says: <br>//2</div>", $message);

but it does not work! can anyone help??!
too lazy to type it out for your specific case, but here's something similar I used for my own forum

$text = preg_replace("/\[url\](.+?)\[\/url\]/", "<A HREF=\"$1\" TARGET=\"_blank\">$1</A>", $text);

$text = preg_replace("/\(.+?)\[\/url\]/", "<A HREF=\"$1\" TARGET=\"_blank\">$2</A>", $text);

the first one changes
http://
to <A HREF="http://" TARGET="_blank"></A>

the latter changes [url=http://]abc
to <A HREF="http://" TARGET="_blank">abc</A>

Just modify things for quotes
Make sure you check for ] characters in usernames, and check for nested comments (you won't be able to use preg_replace if you want nested comments...)
thats what im asking is How to do those two things... i dont know how...
A few alternatives:

1) check $phpbb_root_path . 'includes/bbcode.php'
2) Check pear.php.net to see if the bbcode parser they've got there can help you
3) check phpclasses to see if there's a bbcode class that will do it for you