note 53457 added to function.include
| From: | aaronfultom at softhome dot net | Date: | Thu, 02 Jun 2005 08:07:01 +0000 |
| Subject: | note 53457 added to function.include | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-89767@lists.php.net to get a copy of this message | ||
I have been trying to use php's inlude to include an htm template file which has been marked up
with some php variables. However when using include() the php parsing drops out. This code keeps
the parsing on. Hope its of use to someone.
$buffer = addslashes(get_include_contents('resultspage.htm'));
eval("echo \"".$buffer."\";");
function get_include_contents($filename) {
if (is_file($filename)) {
ob_start();
include $filename;
$contents = ob_get_contents();
ob_end_clean();
return $contents;
}
return false;
}
results page.htm:
....
<TD>{$output[variable]}</TD>
....
----
Manual Page -- http://www.php.net/manual/en/function.include.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+53457
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+53457&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+53457&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+53457&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+53457&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+53457&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+53457&report=yes
Search -- http://master.php.net/manage/user-notes.php