2008年12月3日星期三

Re: [fw-formats] include_path assumption elimination

Why don't you simply have ZF in your include_path? Is there a compelling
reason for it to NOT be in there?

-ralph


On 12/2/08 4:22 PM, "gherson" <gherson@snet.net> wrote:

>
> Solution share:
>
> Ran into a problem today with the Zend/Search/Lucene.php's includes of type
> require_once 'Zend/Search/Lucene/Exception.php';
>
> These assume that the originally browsed PHP script is in every case exactly
> 3 folders up from Exception.php. That wasn't the case for me, so in the
> script that includes Lucene.php, I wrapped that include in two lines:
> ini_set('include_path', '.;' . dirname(__FILE__)); // (Use : instead of
> ; on Unix.)
> require_once 'Zend/Search/Lucene.php';
> ini_restore('include_path');
>
> That didn't come to me in an eye blink, though, so maybe a similar ini_set()
> and ini_restore() line can be put atop and bottom, respectively, of
> Lucene.php?
>
> Similarly, if not as easily, maybe PHP's require('path/to/file') and
> include('path/to/file') functions can be given an option to use the
> immediate includer's directory as the starting point to 'path/to/file'?
> That'd allow me to avoid long-winded
> require_once dirname(__FILE__) .
> "/path/from/current/file/to/anotherinclude.inc";
> statements.
>
> thanks,
> George

--
Ralph Schindler
Software Engineer | ralph.schindler@zend.com
Zend Framework | http://framework.zend.com/

没有评论: