Hi!

Is there a ready to use PHP function for including ONLY if the file exists?

I tried it like this:

[main.php]
include_once("lib.php");
....later
includeIf("somefile.php");

[lib.php]
function includeIf($filename)
{
        if (!file_exists($filename))
        {
                include_once($filename);
        }
}

You see the problem. The somefile.php seems to be included in the wrong file. It should be included in the main.php instead of lib.php.

How can i still have the function in lib.php but the file will be included in main.php

Thanx in advance
J

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to