PDA

View Full Version : Problems eval'ing bbcodeparse'd string.


LancerForums
04-11-2002, 12:42 AM
I'm trying to use the bbcodeparse function for a messaging section I am writing for my site. It uses a template so I used the eval function to copy the text to a variable. Here's the code:

$bbmessage = bbcodeparse(stripslashes($test[message]));
eval("\$mymessage = \"".$bbmessage."\";");

When I call the script I get this error though:

Parse error: parse error in /home/lancer/forums/test.php(100) : eval()'d code on line 5


If I use addslashes then it parses, but there are slashes after apostrophes and such. If anyone may know how to correct this, that would be great.

Thanks,

Mark

LancerForums
04-11-2002, 01:10 AM
I tried replacing just the apostrophy and it works. Here's the code:
$bbmessage = addslashes(bbcodeparse(stripslashes($im[message])));
eval("\$immessage = \"".str_replace("\'","'",$bbmessage)."\";");


Now, would this work for all cases, or am I missing a better way around this?

Thanks,

Mark