Quantcast
Channel: PHPExcel Forum Rss Feed
Viewing all articles
Browse latest Browse all 2707

New Post: Clean install of PHPExcel 1.7.7: PHPExcel_Worksheet not found

$
0
0
For anyone wondering, I solved this in my autoloader. Separating durectories in classnames with an underscore is something PHP should handle, but doesn't always do. Alter this autoloader to your taste and things will work as far as autoloading goes:
<?php


function my_autoloader($_class)
{


    //for classes where dir separator was replaced by an underscore
    if (strpos($_class, '_') !== False)
    {
        $_class = str_replace('_', DIRECTORY_SEPARATOR ,$_class);
        require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'classes' . DIRECTORY_SEPARATOR . $_class . '.php';

    }

    else
    {
        $possible_class_locations = array();

        $possible_class_locations[] = dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'classes' . DIRECTORY_SEPARATOR . $_class . '.class.php';
        $possible_class_locations[] = dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'classes' . DIRECTORY_SEPARATOR . $_class . '.php';
        $possible_class_locations[] = dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'classes' . DIRECTORY_SEPARATOR . 'phpexcel' . DIRECTORY_SEPARATOR . $_class . '.php';
        foreach($possible_class_locations as $cls)
        {
            if(file_exists($cls))
            {
                require_once($cls);
                break;
            }
            else
            {
                //echo $cls . ' doesnt exist!' . "<br />";
                continue;
            }
        }
        //require_once WEBROOT . '/classes/' . $className . '.class.php';
    }

}
spl_autoload_register('my_autoloader');

?>
Best regards,
Marv

Viewing all articles
Browse latest Browse all 2707

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>