Re: Why wont this work?

From: Date: Mon, 23 Jul 2001 18:10:01 +0000
Subject: Re: Why wont this work?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-59254@lists.php.net to get a copy of this message
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" <boz@musheen.com> wrote in message news:3B5DA101.9272D08D@musheen.com... > > 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 >

« previous php.general (#59254) next »