note 27508 deleted from function.eval by danbrown
| From: | danbrown@php.net | Date: | Sun, 17 May 2009 20:01:45 +0000 |
| Subject: | note 27508 deleted from function.eval by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-155311@lists.php.net to get a copy of this message | ||
Note Submitter: barry at sanyuan dot com dot au
----
Almost driving me to the ends of insanity i found the scripts above for eval html with php inside
would not work on strings like :
<?php for($i=1; $i < 7; $i++) { ?>
<?php echo $i; ?>
additional html here
<? } ?>
In the end, as another option for executing string with both html and php was with tmpnam... eg.
$tmpfname = tempnam ("/tmp", "FOO");
$fp = fopen($tmpfname, "w");
fwrite($fp, $CONTENT[tpl_body]);
fclose($fp);
include($tmpfname);
unlink($tmpfname);
It works perfectly for me and is an alternative to eval for php and html.