Re: Problen set variables in fopen
| From: | Jon Parise | Date: | Wed, 12 Jul 2000 21:16:50 +0000 |
| Subject: | Re: Problen set variables in fopen | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-6280@lists.php.net to get a copy of this message | ||
On Wed, Jul 12, 2000 at 09:16:24PM +0200, Hans-Peter Straub wrote:
> I do a
>
> $template = fopen ("incdir/emplate.txt","r");
>
> while (!feof($template)) {
> $output=fgets($template,256) ;
> $testmessage.=$output ;
> }
>
> and in the template.txt files there are some variables wrote down in
> the form:
>
> -->> $variable
>
> I want to set some values to this variables when while is running,
> but i only get teh clear text "$variable" in output. How can i get
> changed this to set the values of the vars to this??
I'm not entirely sure I follow you, but I think you can accomplish
what you want either by putting '<?php' at the beginning of the
template file and '?>' at the end, or by reading up on the eval()
function (http://www.php.net/manual/function.eval.php).
--
Jon Parise (jon@csh.rit.edu) . Rochester Inst. of Technology
http://www.csh.rit.edu/~jon/ : Computer Science House
Member