Hi Dan,

try changing:
$tempfile = fopen ("$filedir" . "/" . "$filename" . ".html", "r") or die
To:
$tempfile = fopen ($filedir . "/" . $filename . ".html", "r") or die

for starters ;)

James.

"Dan Krumlauf" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> 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">
>
> <html>
> <head>
>  <title>No Title</title>
> </head>
>
> <body>
>
> <NEWS>This is some text</NEWS>
>
> </body>
> </html>
> ********************************************
>
> Results in
>
> Parse error: parse error in /php/work/boz/news_publish.php on line 8
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to