Re: [fw-general] loading non-ZF classes using autoloader

2008-03-28 Thread rcastley

This suggestion works great in ZF 1.0.4, but since upgrading to 1.5.0 I can't
get it to work.  The errors I get are:

[Fri Mar 28 11:53:04 2008] [error] [client 127.0.0.1] PHP Warning: 
Zend_Loader::include_once(DOMPDF\\Exception.php) [
function.Zend-Loader-include-once function.Zend-Loader-include-once ]:
failed to open stream: No such file or directory in C:\\Program
Files\\Apache Software
Foundation\\Apache2.2\\htdocs\\ZendFramework\\library\\Zend\\Loader.php on
line 83, referer: http://localhost/Magik/
[Fri Mar 28 11:53:04 2008] [error] [client 127.0.0.1] PHP Warning: 
Zend_Loader::include_once() [ function.include function.include ]: Failed
opening 'DOMPDF\\Exception.php' for inclusion
(include_path='widgets/Macro4/Accounting/RunReport\\;.;C:\\php5\\pear;..\\ZendFramework\\library;.\\library;.\\library\\DomPDF;.\\application\\models;.\\application\\config;.\\widgets')
in C:\\Program Files\\Apache Software
Foundation\\Apache2.2\\htdocs\\ZendFramework\\library\\Zend\\Loader.php on
line 83, referer: http://localhost/Magik/
 etc.

Anyone else having the same issue/problems or better still is there a
solution :-)



Ken Petri wrote:
 
 
 Matthew Weier O'Phinney-3 wrote:
 
 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/
 
 
 
 Thank you, Matthew! This worked perfectly. I had the registerAutoload in
 the bootstrap file, and the require_once was in place, so all I had to do
 was add the spl_autoload_register(), et voila!
 
 Zend Framework is terrific. So is DOMPDF--might be a good model for
 redesign of Zend_PDF for version 1.5.
 
 Again, thanks. Saved my bacon!
 
 ken
 
 

-- 
View this message in context: 
http://www.nabble.com/loading-non-ZF-classes-using-autoloader-tp14705760p16349621.html
Sent from the Zend Framework mailing list archive at Nabble.com.



RE: [fw-general] loading non-ZF classes using autoloader

2008-03-28 Thread Robert Castley
 
This suggestion works great in ZF 1.0.4, but since upgrading to 1.5.0 I
can't get it to work.  The errors I get are:

[Fri Mar 28 11:53:04 2008] [error] [client 127.0.0.1] PHP Warning: 
Zend_Loader::include_once(DOMPDF\\Exception.php) [
function.Zend-Loader-include-once function.Zend-Loader-include-once ]:
failed to open stream: No such file or directory in C:\\Program
Files\\Apache Software
Foundation\\Apache2.2\\htdocs\\ZendFramework\\library\\Zend\\Loader.php on
line 83, referer: http://localhost/Magik/ [Fri Mar 28 11:53:04 2008] [error]
[client 127.0.0.1] PHP Warning: 
Zend_Loader::include_once() [ function.include function.include ]: Failed
opening 'DOMPDF\\Exception.php' for inclusion
(include_path='widgets/Macro4/Accounting/RunReport\\;.;C:\\php5\\pear;..\\Ze
ndFramework\\library;.\\library;.\\library\\DomPDF;.\\application\\models;.\
\application\\config;.\\widgets')
in C:\\Program Files\\Apache Software
Foundation\\Apache2.2\\htdocs\\ZendFramework\\library\\Zend\\Loader.php on
line 83, referer: http://localhost/Magik/  etc.

Anyone else having the same issue/problems or better still is there a
solution :-)

It looks like the Zend_Loader is taking into account the '_' used in this
external library and formatting them into '\'.  Is there anyway to disabled
this?  I am using the registerAutoload() in my bootstrap.





Ken Petri wrote:
 
 
 Matthew Weier O'Phinney-3 wrote:
 
 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/
 
 
 
 Thank you, Matthew! This worked perfectly. I had the registerAutoload 
 in the bootstrap file, and the require_once was in place, so all I had 
 to do was add the spl_autoload_register(), et voila!
 
 Zend Framework is terrific. So is DOMPDF--might be a good model for 
 redesign of Zend_PDF for version 1.5.
 
 Again, thanks. Saved my bacon!
 
 ken
 
 

--
View this message in context:
http://www.nabble.com/loading-non-ZF-classes-using-autoloader-tp14705760p163
49621.html
Sent from the Zend Framework mailing list archive at Nabble.com.



This email has been scanned for all known viruses by the MessageLabs Email
Security Service and the Macro 4 plc internal virus protection system.



This email has been scanned for all known viruses by the MessageLabs Email
Security Service and the Macro 4 plc internal virus protection system.




This email has been scanned for all known viruses by the MessageLabs Email 
Security Service and the Macro 4 plc internal virus protection system.


Re: [fw-general] loading non-ZF classes using autoloader

2008-01-09 Thread Matthew Weier O'Phinney
-- 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/


[fw-general] loading non-ZF classes using autoloader

2008-01-08 Thread Ken Petri

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!

ken
-- 
View this message in context: 
http://www.nabble.com/loading-non-ZF-classes-using-autoloader-tp14705760s16154p14705760.html
Sent from the Zend Framework mailing list archive at Nabble.com.