Re: how to assign a parsed file to a variable?

From: Date: Tue, 27 Jun 2000 14:25:14 +0000
Subject: Re: how to assign a parsed file to a variable?
Groups: php.general 
Request: Send a blank email to php-general+get-3343@lists.php.net to get a copy of this message
Vboy, You could: 1) use the ob_* functions as several other people have explained 2) omit the start/end php tags in your include file and only add them (if you need them) to the variable containing the code when you are actually ready to display. You may have another good reason not to do it this way, but it's a thought. Regards, Carroll Barrett -----Original Message----- From: Vboy <vboy@bigfoot.com> To: PHP List <php-general@lists.php.net> Date: Monday, June 26, 2000 8:13 PM Subject: [PHP-GENERAL] how to assign a parsed file to a variable? >I got several mails asking if I got any replies/solutions for the >following problem that I posted days ago. Regretfully, the answer >is no. So I repost it again and see if it can be done by PHP... > >GOAL: 1) parse an external file with PHP+HTML codes > 2) assign the result string to a variable instead of displaying > directly on the PHP script > >Example follows... > >Thank you! > >-------- Original Message -------- >Subject: eval(...) not printing on browser, but assigning to a variable >Date: Sat, 24 Jun 2000 11:27:52 +0800 >From: Vboy <vboy@bigfoot.com> >To: PHP List <php-general@lists.php.net> > >Dear all, > >-- test.inc (1 line file)-- ><?echo "HELLO";?> >-- >-- test.php (1 line file)-- >$fcontent=file("test.inc"); >while ( list($line_num,$line) = each($fcontent) ) { > $msg .= $line; >} >eval("?>$html_msg"); >-- > >It echos "HELLO" on test.php. > >However, I do not want the string "HELLO" printing on test.php, >I want it assigned to avariable instead, so I can use it for other >purpose. e.g. as a mail body > >How do I accomplish that? > >Thanks. > >Regards, >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 >

« previous php.general (#3343) next »