views:

51

answers:

3

I've build a simple templating engine for a friend, however i have a problem which i think is a simple one

the script looks for these values in a template

$find = array("{$body}", "{$page_title}");

and replaces them with some other values.

However because they look like php variables I'm getting all sorts of errors and them being undefined.

Any solutions?

+5  A: 

Use single quotes instead of double quotes, then the variables won't be parsed:

$find = array('{$body}', '{$page_title}');
Greg
thanks works a treat.
dotty
+1  A: 

Use:

$find = array('{$body}', '{$page_title}');

The " will parse the variable using ' he variable will not be parsed.

Lizard
+1  A: 

I am not sure if I got it right but try to replay the double-quotes with single-quotes:

$find = array('{$body}', '{$page_title}');
Florian