Okay, I wrote a template script that eval's the code and displays it after it goes through all the code for the script. Here's the function.
function render($cru) {
$path = $this->rpath."admin/templates/";
$style = $this->style;
//evaluate data
eval("\$cru[body] = \"$cru[body]\";");
//call header
$bit = $this->doc("header");
eval("\$bit = \"$bit\";"); echo $bit;
echo $cru[body];
//call footer
$bit = $this->doc("footer");
eval("\$bit = \"$bit\";"); echo $bit;
}
Here's the deal.... Occasionally I have a problem with when it tries to display text if the data entered into the database contains a " the eval goes all to heck and screws up the script. So I need a solution. Here's what I'm thinking tell me what you think.
I need a function(I have no idea what function to use) that scans the text a sees if it includes a ". If so then I need it to addslashes to the ". I don't want to addslashes if the text doesn't contain a ". So what's the best solution to fixing this? Am I on the right path or do you have a better idea? Any input would be great.
Thanks.