开发者

Managing require_once in classes called by Zend and non-Zend classes

I have a web Zend framework application that uses registernamespace and Zend_Autoloader_Resource to manage the requires needed for various modules. I also have a series of simple classes that will be called by cron jobs. Between the two are a number of classes that should be shared by both. What's the best way of managing the require_once statements such that neither side gets it knickers twisted?

Clarification: 1. There is no specific error that I'm encountering now,开发者_C百科 but in my Zend project I notice if I do put in a require_once, it complains. 2. The reason for require_once at all is because I want to use these modules via Zend for GUI, but I also want to use them without Zend, because of it's overhead. 3. Twisted knickers - to get upset over small stuff


Zend makes use of a define APPLICATION_PATH. It's simple enough to logic around the bits I don't want included in the classes when being called by Zend to say:

if (!defined('APPLICATION_PATH')){
    include_once "path/class";
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜