i have 2 little problems with a forum i am working on.
i wrote a bbcode addon (similar to the one of this board) so people can use more functions, without having to deal with the problems enabled html can cause.
PROBLEM 1:
ok... so - it all works fine - only one tag i am having problems with - and this is the [QUOTE_] tag. it works fine if it is used once. but when you quote a post including a quote it gets totally messed up, since the opening and closing qoute tags dont seem to match anymore.
see the result here for example: http://www.nevergetoveryou.net/board/show.php?messageId=1|1318
the function i use to parse the quotes looks like this:
$string = preg_replace("/\[quote_\](.*?)\[\/quote_\]/si", "<DIV align=\"right\"><TABLE WIDTH=\"85%\" CLASS=\"quote\"><TR><TD><FONT CLASS=\"module\">\\1</TD></TR></TABLE></DIV>", $string);
$string = eregi_replace("\[quote_\]", '', $string);
$string = eregi_replace("\[/quote_\]", '', $string);
if anybody would have suggestions for me to improve this i would be very thankful...
by the way: i used [quote_] WITHOUT the underscore in the code - but otherwise it parses the vb code here too...
PROBLEM 2:
is it possible to accomplish the following:
bbcode: [member]webkid[/member]
should generate the following output:
<a href="http://www.nevergetoveryou.net/members.php?userId=1">webkid</a>
whereas the userId "1" is the value for the nickname "webkid" which gets looked up in the database.
right now i use the following code:
$string = preg_replace("/\[member\](.*?)\[\/member\]/si", "<a href=\"http://www.nevergetoveryou.net/members.php?userId=\\1\">\\1</a>", $string);
$string = eregi_replace("\[member\]", '', $string);
$string = eregi_replace("\[/member\]", '', $string);
but of course this produces
<a href="http://www.nevergetoveryou.net/members.php?userId=webkid">webkid</a> - which will not work...
is there a way to get the value from the database in the replace string???
thanks a lot in advance!!!
sid