Being a fairly new member, I am not sure what the best place is for the following:
In the Definitive Guide To Yii under the section "Using 3rd-Party Libraries" there is the following code,
to be placed at the beginning of a controller class
Yii::import(‘application.vendors.*’); // line 1
require_once(‘Zend/Search/Lucene.php’);// line 2
This particular example code should make it possible to use the class Zend_Search_Lucene in the code. A prerequisite for this is that the Zend library is placed under protected/vendors directory.
I have done that, but when I run the controller/action where this code is in, I get the following error
require_once(Zend/Search/Lucene.php): failed to open stream: No such file or directory
But testing with file_exists() function confirms that the file protected/vendors/Zend/Search/Lucene.php does exist.
If I change the argument of line 2 from ‘Zend/Search/Lucene.php’ into ‘protected/vendors/Zend/Search/Lucene.php’ the code of line 2 is accepted, but then inside the file Lucene.php there are require_once statements such as:
27 require_once ‘Zend/Search/Lucene/Document/Html.php’;
which then give the same error "failed to open stream: No such file or directory.
To me it looks like the Yii::import statement fails to add the directory Zend to the include path of directories.
My understanding is that if the Zend directory is added to the include path, that then any statement require_once(argument) where the string "argument" starts with "Zend" should work correctly, provided of course that the whole argument refers to a file which indeed exists.
Can you please help me with this problem? What could be wrong in my setup that causes this problem?
I really want to use the whole Zend_Pdf package and there are many places where require_once('Zend/…) is used. Changing all these places to an absolute path and changing the file names to the name of the class (e.g. changing the filename Pdf.php in the location Zend/ to “Zend_Pdf” is a lot of work, which I like to avoid.
Martin de Groot