larry98765
Registered
Hi All,
I'm putting blocks of HTML code into variables using herdoc format ($var=<<<EOF etc.) and I'd like those blocks to sometimes include parse-able php, so that when the variable is later called, php should execute any php it finds.
But as I expected, when I put in a php chunk into the HTML, the variable doesn't get properly set, because I'm nesting php within php in a sense. Here's what I mean:
<?php
$foo= <<<EOF
<h4>Some HTML code</h4>
<p>Some more html code</p>
<?php SOME PHP CODE ?>
<p>Some more html code</p>
EOF;
?>
and later on
<?php echo $foo ?>
PHP doesn't seem to like this, and I don't blame it. So what's the solution?
I'm putting blocks of HTML code into variables using herdoc format ($var=<<<EOF etc.) and I'd like those blocks to sometimes include parse-able php, so that when the variable is later called, php should execute any php it finds.
But as I expected, when I put in a php chunk into the HTML, the variable doesn't get properly set, because I'm nesting php within php in a sense. Here's what I mean:
<?php
$foo= <<<EOF
<h4>Some HTML code</h4>
<p>Some more html code</p>
<?php SOME PHP CODE ?>
<p>Some more html code</p>
EOF;
?>
and later on
<?php echo $foo ?>
PHP doesn't seem to like this, and I don't blame it. So what's the solution?