2
votes

Why ist the Zend_Autoloader not able to load my Classes. Tha path to the library should be: /root/application/modules/modulexy/MyLib (Zend Version 1.12)

What i did:

  1. In the public/index.php

set_include_path(implode(PATH_SEPARATOR, array( ... realpath(APPLICATION_PATH . '/modules/modulexy/MyLib'), ... )));

  1. In the Controller

    $al = Zend_Loader_Autoloader::getInstance(); $al->registerNamespace("MyLib_");

I don't want to move the library to /root/library

1
What is the name of your class and how is the file named and placed into the lib? - Tobias Golbs
The name of the Classes is somthing like that: MyLib_Model_Abstract and the Path is: MyLib/Model/Abstract.php - Gabe
if u are using linux might be something to do with capital letters, try using lowercase letters.. - joao

1 Answers

2
votes

Your include path shouldn't include the "MyLib" part.

This should work:

set_include_path(implode(PATH_SEPARATOR, array(
      ...
      realpath(APPLICATION_PATH . '/modules/modulexy'),
      ...
      )));

Alternatively, if you want that lib extra directory, you could have

set_include_path(implode(PATH_SEPARATOR, array(
      ...
      realpath(APPLICATION_PATH . '/modules/modulexy/lib'),
      ...
      )));

And place your class "MyLib_Model_Abstract" in "/modules/modulexy/lib/MyLib/Model/Abstract.php