-- Ken Petri <[EMAIL PROTECTED]> wrote
(on Tuesday, 08 January 2008, 09:54 PM -0800):
> I would like to use DOMPDF with Zend Framework. DOMPDF has its own autoloader
> (called "DOMPDF_autoload") that loads necessary class files so the user can
> instantiate the main DOMPDF class (called, yes, you guessed it, DOMPDF).
>
> I have the DOMPDF files in a directory called "library" at the root of my ZF
> application tree.
>
> I am able to use require_once to load the configuration file for DOMPDF--the
> config file is found and no errors occur. However, when I try to "new" a
> DOMPDF instance, ZF complains that "Class 'DOMPDF' was not found in" my
> controller.
>
> I believe that to make DOMPDF work, I need to use the DOMPDF autoloader, but
> I can't figure out how to do this within ZF.
>
> FYI, in my index.php bootstrap file, I am using
> Zend_Loader::registerAutoload() so that I don't have to manually load ZF
> classes before using them.
>
> Any help is greatly appreciated. Thank you!
I can't be certain, as I don't know the DOMPDF code, but you should be
able to load it as an additional spl_autoload handler:
require_once 'Zend/Loader.php';
require_once 'path/to/file/containing/DOMPDF_autoload...';
Zend_Loader::registerAutoload();
spl_autoload_register('DOMPDF_autoload');
spl_autoload() is an improvement over __autoload() precisely for
situations like this, where you need to mix and match libraries that
have their own autoloading logic, and is why we adopted it in ZF.
--
Matthew Weier O'Phinney
PHP Developer | [EMAIL PROTECTED]
Zend - The PHP Company | http://www.zend.com/