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>
printing mysql template field variable prints as string
Moderator: General Moderators
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
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:You can then use simple string replacement or regular expressions to translate {{title}} to $title.
Code: Select all
<title>{{title}}</tilte>