HTML file with variable replacement.

From: Date: Thu, 02 Aug 2001 18:21:06 +0000
Subject: HTML file with variable replacement.
Groups: php.general 
Request: Send a blank email to php-general+get-60979@lists.php.net to get a copy of this message
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 (#60979) next »