Re: HTML file with variable replacement.

From: Date: Thu, 02 Aug 2001 18:22:15 +0000
Subject: Re: HTML file with variable replacement.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-60980@lists.php.net to get a copy of this message
I would seriously suggest you take a good look at Smarty at http://www.phpinsider.com/php/code/Smarty/ Don't re-invent the wheel. -Rasmus On Thu, 2 Aug 2001, Jason Bell wrote: > Ok, I'm trying to seperate my php from my html.... the method I've been > trying to use is like so: > > $html = fread(fopen("htmlpage.html", "r"), > filesize("htmlpage.html")); > print $html; > > > This works perfectly fine, except if I want to use a variable.... > > lets say that my htmlpage.html includes the following: > > <CENTER><H2>Hello! Your variable has a value of: $myvar</H2></CENTER> > > and my test.php file is as follows: > > <?php > $myvar = "It works!"; > $html = fread(fopen("htmlpage.html", "r"), > filesize("htmlpage.html")); > print $html; > ?> > > I would expect the output to be: > > Hello! Your variable has a value of: It works! > > but what I get is: > > Hello! Your variable has a value of: $myvar > > > any hints/tips/suggestions? Is there another way that I should be doing > this? > > thanks! > > Jason > > > > >

« previous php.general (#60980) next »