• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using Zend Framework components in CI

To Canglan,

First of all, Zend_Loader is a part of the framework, so IMHO it's a better for your app to use it from a app design point of view.

Second, if you would check the manual a little bit more you would see that it has couple of methods.
The one we are using here is the loadClass - and it does not only include required file( via loadFile actually), but checks as well if the class exists. and if not it will throw an exception, so you have a possibility to do something about it should it fail.

And third and last for now, there is a possibility to assign autoload function to Zend_Loader, and free yourself from doing
before instantiation Zend classes you wish to work with.

Actually thinking about it, probably the better design solution would be removing this library, creating extended Zend_Loader class, and extending CI_Loader class to work with it.


[eluser]Phil Sturgeon[/eluser]
Excellent, loadClass() does what I was looking for. Might not be possible in raw PHP but their loader class allows you to pass the constructor an array of parameters.


This can easily be added to CI loader. Should it be $this->load->zend(? Not sure of the best implementation.

Also, not sure we need to use Zend Loader, we can do some basic checks and exception handling in the CI loader class.

second parameter for loadClass is a diriectory array to look in.

[eluser]Randy Casburn[/eluser]
[quote author="pyromaniac" date="1229353170"]You guys slightly missed the point ...[/quote]

Yes, I sure did. Thought you were writing your own sorry.

[eluser]Phil Sturgeon[/eluser]
[quote author="mihailt" date="1229365727"]second parameter for loadClass is a diriectory array to look in.[/quote]

Wasn't paying enough attention it seems. Well, pass on this project then. Smile

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.