Hmm ...
PHP Code:
<?php
$foobar = 'Foo Bar';
$templates['header'] = '<table width="100%" class="mytable"><tr><td>$foobar</td></tr></table>';
$compiled_header_template = str_replace('\\\\$', '\\$', addslashes($templates['header']));
eval('$header = "' . $compiled_header_template . '";');
echo $header;
?>
Output
HTML Code:
<table width="100%" class="mytable"><tr><td>Foo Bar</td></tr></table>
Seems to work for me.