[TYPO3-mvc] Using external libraries within Extbase Extension
Hauke Stange
hstange at eheundjanneck.de
Wed Aug 3 17:27:22 CEST 2011
Hi Sebastian.
On Wed, 2011-08-03 at 17:03 +0200, Sebastian Schreiber wrote:
> Hi Hauke,
> have a look at the code from the extension zend_framework.
> http://typo3.org/extensions/repository/view/zend_framework/current/
Ok, I just took a look at it and what happens there? As far as I can see
there is an autoloading function registered for Zend explicitly.
And finaly that's what I've done too (maybe in a less sexy way):
class Tx_Feierabend_Hunger {
public function __construct()
{
$this->initializePearIncludePath();
spl_autoload_register(
array('Tx_Feierabend_Hunger','pearLoader'), true);
}
protected function initializePearIncludePath()
{
$extensionPath = t3lib_extMgm::extPath('gpqg');
$pearPath = $extensionPath . 'Resources/Libraries/PEAR/';
set_include_path(
$pearPath . PATH_SEPARATOR . get_include_path()
);
}
public static function pearLoader($className)
{
$parts = array();
if (strpos($className, '_')) {
$parts = explode('_', $className);
}
$extensionPath = t3lib_extMgm::extPath('gpqg');
$pearPath = $extensionPath . 'Resources/Libraries/PEAR/';
$classPath = implode(DIRECTORY_SEPARATOR, $parts);
include $pearPath . $classPath . '.php';
}
}
Thanks for your help nevertheless,
Hauke
More information about the TYPO3-project-typo3v4mvc
mailing list