That's great, thankyou (although still having great difficulty!!) Sorry to be a pain, but is there a quick simple way I can display a static page on the URL whilst I figure this out? My boss isn't too pleased.. oops
Thankyou!
You can dynamically check to see whether or not the file was included, and then automatically display the regular page or some other content.
First thing you'll want to do (at least when you're not testing it) is turn off error-reporting.
This will prevent the errors from showing up and telling your users that something is broke. You can do this by adding this line to the top of the file.
ini_set("display_errors", "Off");
Then, you can add a conditional statement to check if the file was included or not. If include() successfully finds the file, it returns "True." Otherwise, it will return false.
Seeing as you're including a lot of files, I'd create an error flag, set that flag to "True" if any of the files aren't included, and then at the end of the includes check whether or not the flag was set. Like this...
$error = false;
if ( !include("exampleFile.php")) {
// There was an error, exampleFile.php wasn't found
$error = true; }
if ( !include("exampleFile2.php")) {
// There was an error, exampleFile2.php wasn't found
$error = true; }
if ($error == true) {
// There was an error
// Include your alternate info here
// Or use header("Location: http://domain.com/static-page.html"); to redirect
} else {
// There was on error. Execute the regular page here.
}
Or... you could just rename the file you're working with to something else. Then create a new file with the old name (and no includes). Once you've fixed the original file, change the names back.
Good luck,
- Walkere