Re: require?fread?fopen?

From: Date: Thu, 22 Jun 2000 16:45:22 +0000
Subject: Re: require?fread?fopen?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-2653@lists.php.net to get a copy of this message
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 -- //*** how do I get assign the contents in html_ver.inc into $msg and still // get PHP codes evaluated at last? // 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? $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. ----------------- Thanks. Vboy Data Driven Design wrote: > instead of > > echo $html_msg; > > use > > eval("?>$html_message"); > > as long as you have the '<?' & '?>' tags in your string it will > work fine. > > Data Driven Design > PO Box 1084 > Holly Hill, FL 32125-1084 > Phone : (904) 226-8979 > URL : http://datadrivendesign.com > URL : http://rossidesigns.net > > ----- Original Message ----- > From: Vboy <vboy@bigfoot.com> > To: <php-general@lists.php.net> > Sent: Thursday, June 22, 2000 9:40 AM > Subject: [PHP-GENERAL] require?fread?fopen? > > | 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 > | > | > | -- > | PHP General Mailing List (http://www.php.net/) > | To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > | For additional commands, e-mail: php-general-help@lists.php.net > | To contact the list administrators, e-mail: php-list-admin@lists.php.net > | > | > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#2653) next »