HTML into PHP Variable (HTML outside PHP code)
Have you tried "output buffering"?
<?php ... ob_start();?><html> <head>...</head> <body>...<?php echo $another_variable ?></body></html><?php $variable = ob_get_clean(); ...?>
I think you want heredoc syntax.
For example:
$var = <<<HTML<html> <head>random crap here</html>HTML;
I'm not really sure about what you are trying to accomplish, but I think something like the heredoc syntax might be useful for you:
<?$variable = <<< MYSTRING<html> <head>...</head> <body>...</body></html>MYSTRING;
However if you are trying to make HTML templates I would highly recommend you to get a real templating engine, like Smarty, Dwoo or Savant.