note 27508 added to function.eval
| From: | barry at sanyuan dot com dot au | Date: | Mon, 09 Dec 2002 12:03:58 +0000 |
| Subject: | note 27508 added to function.eval | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-40566@lists.php.net to get a copy of this message | ||
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.
--
http://www.php.net/manual/en/function.eval.php
http://master.php.net/manage/user-notes.php?action=edit+27508
http://master.php.net/manage/user-notes.php?action=delete+27508
http://master.php.net/manage/user-notes.php?action=reject+27508