Your line in in news_publish.php is:
while($templine=fgets($tempfile, 4096) ) {
if you want to test if $templine is equal to fgets($tempfile, 4096) then you
should use 2 equal signs. So,
while($templine==fgets($tempfile, 4096) ) {
1 equal sign sets the value of the right side to the left.
HTH,
Pat
In a message dated 7/23/01 12:18:51 PM Eastern Daylight Time, [EMAIL PROTECTED]
writes:
> news_publish.php
> ***************
> <?php
> function DoTemplate() {
> $filedir = func_get_arg(0);
> $filename = func_get_arg(1);
> $news = func_get_arg(2);
> $tempfile = fopen ("$filedir" . "/" . "$filename" . ".html", "r") or die
> ("Failed to open template file $filename");
> while($templine=fgets($tempfile, 4096) ) {
> $templine = preg_replace("/(<NEWS>)(.*?)(<\/NEWS>)/i","\\1$news\\2",
> $templine));
> print ($templine);
> }
> fclose ($tempfile);
> }
> $template_dir="/php/work/boz";
> $template_filename="news";
> $news="SOME STUFF GOES HERE BUILD IT AS A VAR";
> DoTemplate($template_dir,$template_filename);
> ?>
> **********************************************
>
> news.html
> *******************************
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
>
>
> <head>
> <title>No Title</title>
> </head>
>
>
>
> <NEWS>This is some text</NEWS>
>
>
>
> ********************************************
>
> Results in
>
> Parse error: parse error in /php/work/boz/news_publish.php on line 8
>
>