Here's my problem: I'm doing the same exact thing as above, except instead of saving the changes to the same file, I'm saving them to a new file in a new directory (the save works, no problem there).
My problem: ereg_replace won't replace anything from my $myfile_contents variable. Here's the code as it stands on 26.07.2000
<?php
$myfile = fopen("index.php3", "r+");
$myfile_contents = fread( $myfile, filesize( "index.php3" ) );
$indexContents = ereg_replace("{left_content}", "test test test", $myfile_contents);
$leftNav = ereg_replace("{search-tab}", "test test test", $myfile_contents);
$leftNav = ereg_replace("{bestbets-tab}", "test test test", $myfile_contents);
$leftNav = ereg_replace("{movies-tab}", "test test test", $myfile_contents);
$newfile = "../gulfcoasting-final/index.html";
$myhandle = fopen($newfile, "w") or die ("cannot open $newfile for writing!");
fwrite($myhandle, $myfile_contents) or die ("cannot write to $newfile!");
fclose($myhandle);
echo("<a href='../gulfcoasting-final/index.html'>index.html</a>");
?>
Any suggestions? It looks good to me, just when you preview the output file (../gulfcoasting-final/index.html) you still see {section-tab} 's all over the place!
This also happens if I change {blah-tab} to <!--blah_tab--> or even !!BLAH!!