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

Andrew Seguin asegu at borg.darktech.org
Mon Nov 10 19:20:37 CST 2003


I have two ideas, basicaly both are the same: store the HTML in a seperate
file. get the contents/include depending on need.

if you only need html:
--------
$html_file = './htmlfile.html';
$msg = file_get_contents($html_file);
echo($msg);
mail ($email, $subject, $output, $headers);
--------

or, if you have some php in your html output:
--------
$phpbuilt_html_file = './phpfile.php';
$msg = include($phpbuilt_html_file);
echo($msg);
mail ($email, $subject, $outupt, $headers);
--------

hope that helps.
Andrew

> 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
>
> --
> * * Please support the community that supports you.  * *
> http://evolt.org/help_support_evolt/
>
> For unsubscribe and other options, including the Tip Harvester
> and archives of thelist go to: http://lists.evolt.org
> Workers of the Web, evolt !
>
>



More information about the thelist mailing list