RE: [PHP] HTML if no PHP

2003-02-04 Thread John W. Holmes
> 3) Include and execute capturing critical errors: > > $hf = fopen($incfile, 'r'); > if ($hf) { > $buffer = fread($hf, filesize($incfile)); > fclose($hf); > } > if ($buffer) { > global $php_errormsg; > $php_errormsg = null; > @eval($buffer); > $err = $php_errormsg; > } >

Re: [PHP] HTML if no PHP

2003-02-04 Thread Ernest E Vogelsinger
1) Include file not found: if (file_exists($incfile)) include($incfile); else include ($error_html_file); 2) Error in file: global $php_errormsg; $php_errormsg = null; @include($incfile); $err = $php_errormsg; if ($err) echo "The include file $incfile has an error: $err"; The trick is

Re: [PHP] HTML if no PHP

2003-02-04 Thread Philip Olson
> I want to display an HTML page if PHP can't load an include > file or otherwise has an error or just doesn't work. > How do I do this? include returns false on failure and here's a hack to demonstrate. Once you implement your own error handling, be sure to set error_reporting accordingly or

Re: [PHP] HTML if no PHP

2003-02-04 Thread John Nichel
if ( !@include ( "myfile.php" ) ) { // do this if file cannot be included ...code... ...code... } Bob Lockie wrote: I want to display an HTML page if PHP can't load an include file or otherwise has an error or just doesn't work. How do I do this? -- PHP General Mailing List (h

Re: [PHP] HTML if no PHP

2003-02-04 Thread V Dub
Quoting Bob Lockie <[EMAIL PROTECTED]>: ### ### I want to display an HTML page if PHP can't load an include file or ### otherwise has an error or just doesn't work. ### How do I do this? ### if (!$variable){print('your html stuff');} Kinda basic, but it might help. Cheers! VW ### ### --

RE: [PHP] HTML if no PHP

2003-02-04 Thread Jon Haworth
Hi Bob, > I want to display an HTML page if PHP can't load an > include file or otherwise has an error or just doesn't work. > How do I do this? Not sure you can, especially not for the "just doesn't work" scenario. FWIW, you can test for the existence of a file before including it: if (file_e