assign a PHP+HTML file to a variable
| From: | Vboy | Date: | Thu, 22 Jun 2000 23:35:44 +0000 |
| Subject: | assign a PHP+HTML file to a variable | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-2721@lists.php.net to get a copy of this message | ||
Hello All,
Let me illustrate my problem better by an example:
-- html_ver.inc --
<html>
<head><title><?echo $myTitle;?></title>
<body>
..
... hundreds of lines of HTML+PHP codes in this file
-----------------
-- script.php --
$myTitle = "Testing Page";
$boundary = ....etc;
$msg .= "\n\n--" . $boundary . "\n";
$msg .= "Content-Type: text/html; charset=us-ascii\n";
$msg .= "Content-Transfer-Encoding: 7bit\n\n";
$msg .= "<!doctype html public \"-//w3c//dtd html 4.0
transitional//en\">\n";
$msg .= $html_msg; //********
$msg .= "\n\n--" . $boundary . "--\n";
mail("..","..","$msg","MIME-Version: 1.0....); <-- I know how
to make
this
work.
-----------------
//*** how do I assign the contents in html_ver.inc into $msg and still
// get PHP codes parsed *before* adding it to mail()?
//
// I tried the following code (thanks to a nice folk here):
// $fcontent=file("html_ver.inc");
// while ( list($line_num,$line) = each($fcontent) ) {
// $html_msg .= $line;
// }
// but it doesn't seem to work.. The mail I received from this script
// can display the HTML correctly but CANNOT show the results of PHP
// script... Viewed the source of the mail, it SHOWS those <?..php
// codes...?>!!
// Codes are not evaluated before assigned to $html_msg ?
// eval("?>$html_message"); simply outputs the evaluated result on the
// script page..
// but I want that show on the mail only... any clues?
Thank you very much!
Vboy