* [EMAIL PROTECTED] <[EMAIL PROTECTED]>:
> I'm experiencing some issues with autoLoad with pear packages. DB_Error is
> contained within the DB.php, but my autoload method is trying to split the
> underscores with forward slashes and then load. Supressing errors with @
> still doesnt work, its triggering a php error. Any ideas ?

Sounds to me like you may need to do a quick call to file_exists()
before trying to load it up. This may involve looping through the
elements in your include_path to build the paths:

    // assuming $class = class requested
    $file = str_replace('_', '/', $class) . '.php';
    $include_path = ini_get('include_path');
    $paths = explode(':', $include_path);
    $final = '';
    foreach ($paths as $path) {
        if (file_exists("$path/$file")) {
            $final = "$path/$file";
            break;
        }
    }
    if (!empty($final)) {
        include_once $final;
    }

-- 
Matthew Weier O'Phinney           | WEBSITES:
Webmaster and IT Specialist       | http://www.garden.org
National Gardening Association    | http://www.kidsgardening.com
802-863-5251 x156                 | http://nationalgardenmonth.org
mailto:[EMAIL PROTECTED]         | http://vermontbotanical.org

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

Reply via email to