require?fread?fopen?
| From: | Vboy | Date: | Thu, 22 Jun 2000 13:40:27 +0000 |
| Subject: | require?fread?fopen? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-2620@lists.php.net to get a copy of this message | ||
GOAL: I'd like to assign a big HTML contents (with PHP embedded) to a
single
variable so that I can send it as a MIME attachement by email.
i.e. $my_var = <The whole HTML contents>
PROBLEM:
I tried saving the HTML+PHP codes into a file called "html_ver.inc",
then read
it with the following commands.
$filename="./html_ver.inc";
$fp = fopen("$filename", "r");
$html_msg = fread($fp,filesize($filename));
fclose($fp);
However, when I do "echo $html_msg" within the script, it only outputs
the HTML
codes but the PHP variables inside html_ver.inc doesn't show anything.
Why?
(It's too cumsy to assign the whole HTML+PHP contents directly to the
variable $html_msg WITHIN the script... that's why I used the above
method
$html_msg .= "<html><head><title>$topic</title></head>\n";
$html_msg .= "<body>";
...
)
Thanks.
Vboy