Posts: 1,813
Threads: 284
Joined: Mar 2003
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??!
earn.
Posts: 394
Threads: 16
Joined: Jun 2003
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
ammit potato!
Posts: 3,343
Threads: 83
Joined: Mar 2003
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...)
Posts: 1,813
Threads: 284
Joined: Mar 2003
thats what im asking is How to do those two things... i dont know how...
earn.
Posts: 3,343
Threads: 83
Joined: Mar 2003
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