-- bytte <[email protected]> wrote
(on Friday, 10 April 2009, 06:22 AM -0700):
> I'm using DOMPDF in a project of mine and I was wondering how I can call
> DOMPDF's autoload function so it can function together with the one from
> Zend Framework.
>
> Here's what DOMPDF says:
>
> /**
> * DOMPDF autoload function
> *
> * If you have an existing autoload function, add a call to this function
> * from your existing __autoload() implementation.
> *
> * @param string $class
> */
> function DOMPDF_autoload($class) {
> $filename = mb_strtolower($class) . ".cls.php";
> require_once(DOMPDF_INC_DIR . "/$filename");
> }
>
> How exactly can I make it work together with the ZF?
Use spl_autoload_register() to register that function with the SPL
autoloader:
spl_autoload_register('DOMPDF_autoload');
and then call:
Zend_Loader::registerAutoload();
Starting in ZF 1.8, you can do the following instead:
require_once 'Zend/Loader/Autoloader.php';
$autoloader = Zend_Loader_Autoloader::getInstance();
$autoloader->pushAutoloader('DOMPDF_autoload');
--
Matthew Weier O'Phinney
Software Architect | [email protected]
Zend Framework | http://framework.zend.com/