Re: Retrieve output from HTML or PHP file
| From: | Michael Hulse | Date: | Mon, 30 Jan 2006 05:26:53 +0000 |
| Subject: | Re: Retrieve output from HTML or PHP file | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-229442@lists.php.net to get a copy of this message | ||
I have used output buffering[1] in the past to do what you are describing.
<snip>
# HTML to be written:
ob_start(); // Begin output buffering:
require($_SERVER['DOCUMENT_ROOT'].$path.'/'.$name_of_template.$name_of_template_ext);
$message = ob_get_contents(); // Put contents of the above require into $message.
ob_end_clean(); // Clean the output buffer.
</snip>
Probably better ways to do above, but maybe that will help you in some way.
Oh, you may also want to look into the eval() function[2].
[1] http://us2.php.net/manual/en/function.ob-start.php
[2] http://us2.php.net/manual/en/function.eval.php
Cheers, Micky
--
BCC for Privacy: http://www.cs.rutgers.edu/~watrous/bcc-for-privacy.html
My del.icio.us: http://del.icio.us/mhulse