RE: [PHP] Why wont this work?
-Original Message- From: Dan Krumlauf [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 24, 2001 11:24 AM To: [EMAIL PROTECTED] Subject: [PHP] Why wont this work? news_publish.php *** [snip] $templine = preg_replace(/(NEWS)(.*?)(\/NEWS)/i,\\1$news\\2, $templine)); Unless my counting skills have gone downhill lately, this line has more )'s than ('s. --- Mark Roedel ([EMAIL PROTECTED]) | There cannot be a crisis next week. Systems Programmer / WebMaster | My schedule is already full. LeTourneau University | -- Henry Kissinger -- 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]
Re: [PHP] Why wont this work?
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 titleNo Title/title /head NEWSThis is some text/NEWS Results in Parse error: parse error in /php/work/boz/news_publish.php on line 8
Re: [PHP] Why wont this work?
On Wed, 25 Jul 2001 01:53, Dan Krumlauf wrote: news_publish.php *** $templine = preg_replace(/(NEWS)(.*?)(\/NEWS)/i,\\1$news\\2, $templine)); Parse error: parse error in /php/work/boz/news_publish.php on line 8 I think you have one too many closing brackets. May I suggest you acquire an editor that is capable of showing and highlighting matching parentheses? It makes life much easier :-) -- David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA I'm not as thunk as you drink I am. -- 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]