开发者

Zend Framework: When to use /library or /application

after starting with zend framework for sometime, i started to think which classes shld be put where, in the /library or /application?

i think that reusable classes shld go to /library and application specific to /application? am i correct?

1 thing that i find more troublesome when using /application is that its not in the include path and i need to create a resource loader for it? eg.

$resourceLoader = new Zend_Loader_Autoloader_Resource(array(
    'namespace' => 'Application_',
    'basePath' => dirname(__FILE__)
));
$resourceLoader->addResourceType('validator', 'validators/', 'Validat开发者_C百科or');
$resourceLoader->addResourceType('acl', 'acl/', 'Acl');


You're right!

/Library for more generic classes. Like the ones of Zend Framework, and /Application for application specific classes.

And yes, you need to register namespaces and add resources. So that Zend Autoloader can look inside these folders and require than. If all folders were automatically registered, the autoloader could load more slowly.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜