> 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;
> }
>
ly handle any
critical error that would bring your script to an immediate halt in case of
@include.
HTH :)
- Original Message -
From: "Bob Lockie" <[EMAIL PROTECTED]>
To: "php-general Mailing List" <[EMAIL PROTECTED]>
Sent: Tuesday, February 04, 2003 6:11 PM
Subje
> 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
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
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
###
### --
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
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?
--
Sent from Mozilla and GNU/Linux.
Powered by an AMD processor.
--
PHP General Mailing List (http://www.php.net/)
To uns
7 matches
Mail list logo