PEAR Forum :: PHP Extension and Application Repository

PEAR Forum Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Spreadsheet_Excel_Writer autoload problem

 
Post new topic   Reply to topic    PEAR Forum Forum Index -> Structures
View previous topic :: View next topic  
Author Message
greetification



Joined: 03 Feb 2011
Posts: 2

PostPosted: Thu Feb 03, 2011 10:50 pm    Post subject: Spreadsheet_Excel_Writer autoload problem Reply with quote

Hi I'm not sure if this is the right place for this questions but i'm having some trouble autoloading and using the Spreadsheet_Excel_Write package.

I keep getting a Fatal error when I attempt to use the class:

Quote:
LOADED: com/utilities/Spreadsheet.php
LOADED: com/utilities/Spreadsheet/Excel/Writer.php
LOADED: Spreadsheet/Excel/Writer/Workbook.php

Fatal error: Class 'com\utilities\Spreadsheet_Excel_Writer' not found in com/utilities/Spreadsheet.php on line 23


The autoloader looks like this:

Code:
/*** nullify any existing autoloads ***/
    spl_autoload_register(null, false);

    /*** specify extensions that may be loaded ***/
    spl_autoload_extensions('.php');

    /*** class Loader ***/
    function classLoader($class) {
       $class = str_replace('\\', '/', $class);
       $class = str_replace('_', '/', $class);
        $filename = $class.'.php';
        $file = $filename;
       
        if (!file_exists($file)) {
           echo("FAILED TO LOAD: ".$file);
            return false;
        }
       
        echo("LOADED: ".$file."<br />");
        include $file;
    }

    /*** register the loader functions ***/
    spl_autoload_register('classLoader');





and the Spreadsheet class looks like this:

Code:
   
namespace com\utilities;

   use com\utilities\Spreadsheet\Excel\Writer;
   
   class Spreadsheet {
      const FILE_PATH = null;
      const TEMP_FILE_NAME = 'locations.xls';
      const DOWNLOAD_FILE_NAME = 'Locations.xls';
      const FIEL_TYPE = 'xls';
      const TEMP_DIRECTORY = '/temp';
      const WORKBOOK_NAME = 'Locations';
      
      public static function generate() {
         
         $workbook = new Spreadsheet_Excel_Writer(self::TEMP_FILE_NAME);
         $worksheet =& $workbook->addWorksheet(self::WORKBOOK_NAME);
         $workbook->setTempDir(self::TEMP_DIRECTORY);
         

            $worksheet->write(0, 0, "test");
            
         $workbook->close();

      }
   }


Any ideas what i'm doing wrong?
Back to top
View user's profile Send private message
greetification



Joined: 03 Feb 2011
Posts: 2

PostPosted: Fri Feb 04, 2011 12:40 am    Post subject: Reply with quote

So I think i've figured out that I would need to convert all PEAR namespaces to php 5.3 compatible namespaces.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    PEAR Forum Forum Index -> Structures All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



PEAR Forum topic RSS feed 
Powered by phpBB © 2001, 2005 phpBB Group

Provided by Ministry of Web developement