[TYPO3-dev] How to use the new autoloader feature?

Francois Suter fsuter at cobweb.ch
Fri May 29 14:22:37 CEST 2009


Hi,

> have a look to t3lib/core_autoload.php which is the registry for core 
> classes. There is a way for extensions as well providing own registry 
> file in root of extension dir (ext_autoload.php) which will be created 
> by extdeveval

It seems like I wasn't enlightened enough...

Case in point: in the scheduler, I have a test event class class 
"tx_scheduler_testevent" located in file 
t3lib_extMgm::extPath('scheduler', 'class.tx_scheduler_testvent.php').

I have added a ext_autoload.php file in the scheduler extension, which 
contains:

return array(
	'tx_scheduler_testevent' => t3lib_extMgm::extPath('scheduler', 
'class.tx_scheduler_testvent.php')
);

based on what I found in t3lib/core_autoload.php.

Now I'm trying to get an instance of that class using:

$event = t3lib_div::makeInstance('tx_scheduler_testevent');

That fails miserably with a "class not found" error in 
t3lib_div::makeInstance().

Where did I go wrong?

Thanks for any pointer

-- 

Francois Suter
Cobweb Development Sarl - http://www.cobweb.ch




More information about the TYPO3-dev mailing list