replacing variables in file

From: Date: Fri, 10 Aug 2001 20:53:26 +0000
Subject: replacing variables in file
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-62219@lists.php.net to get a copy of this message
in Perl I use template files and parse them through a regx to change say $cat to the value of in the variable, I would like to do the same in php 4 example #open template and replace title and story then save to a new file open (TEMPLATE, "$template") or die "cannot open template please try again"; @template = <TEMPLATE>; close TEMPLATE ; foreach $item (@template) { $item =~s/\$(\w+)/${$1}/g; } #output data to browser $|=1; print "Content-type: text/html\n\n"; print @template ; exit; } Paul Roberts roberts_paul@bigfoot.com +++++++++++++++++++++

« previous php.general (#62219) next »