[thelist] Outputting HTML data to do locations without storing in a buffer

Roger Ly evolt at matchpenalty.com
Mon Nov 10 19:02:33 CST 2003


Hey all,

I'm working on a small internal web application which needs to both
display and email content to individuals.  Since it is a closed system
with everyone using Outlook, we decided to send out HTML emails to make
things a little more readable and consistent with the web interface.

In keeping things easily editable/viewable in standard HTML editors, I
would like to avoid, as much as possible, storing the content of the
browser and emails in a string which just gets outputted to the two
locations.  It'd be nice to write out primarily HTML code, interspersed
with some PHP logic.  Getting that to work when just outputting to a
browser is pretty straightforward, but I can't figure out a good
solution to duplicate that for output to an email.

Is there an easy way to maintain the 95% HTML/5% PHP code and output it
to both a browser and an email without wrapping everything in a string?

Basically, can I avoid:

$output = '
<html>
<head>
<body>
..
</body>
</html>';

echo $output;
mail ($email, $subject, $output, $headers);

Any thoughts would be much appreciated.

Thanks,

Roger



More information about the thelist mailing list