Page 1 of 1

printing mysql template field variable prints as string

Posted: Fri Sep 02, 2005 2:55 pm
by cribs
I am inserting content into a mysql table. When I read the table and print the variable it prints as a string.
example: print $header; will echo <title><?php echo $title; ?></tilte>
$title = 'My New Page';
I want the print $header tag to print <title>My New Page</table>

Posted: Fri Sep 02, 2005 3:13 pm
by feyd
you'll have to research eval(). Do note that usage of eval() can be and is quite dangerous. You may want to change the way you're inserting the text so it's not code, but replacable data such as the following:

Code: Select all

<title>{{title}}</tilte>
You can then use simple string replacement or regular expressions to translate {{title}} to $title.