Hallo an Alle.
Ich bin gerade leider etwas verloren. Ich versuche eine eigene library anzulegen aber irgendwie scheint der Autoloader nicht richtig zu funktionieren.
Ich habe diese Frage und auch diese gefunden aber leider hat mir das nicht weiter geholfen.
Das ist meine Ordnerstruktur.
Das ist meine bootstrap.
Das ist meine komplette application.ini (Ich bin mir darüber im klaren, dass sich die autoloaderNamespaces-Option mit der Anweisung in der Bootstrap doppelt aber es funktioniert beides auch einzeln nicht)
Das ist der Controller in dem ich versuche die "Vita" Classe zu instantiieren.
Ich erholte aber immer diesen Fehler: "Fatal error: Class 'ND_Model_Vita_Vita' not found in C:\xampp\htdocs\ND\application\modules\vita\controllers\IndexController.php on line 17"
Und das ist die Vita Klasse
Hab irgendwo etwas übersehen oder muss ich beim verwenden von Modulen noch etwas beachten?
Ich bin für alle Hinweise Dankbar.
EDIT: Ich habe das Problem etwas eingrenzen können. Ich hab das Projekt mal zu einer Live Umgebung geschoben und da hat alles funktioniert. Es muss also an meiner xampp Umgebung liegen.
Ich bin gerade leider etwas verloren. Ich versuche eine eigene library anzulegen aber irgendwie scheint der Autoloader nicht richtig zu funktionieren.
Ich habe diese Frage und auch diese gefunden aber leider hat mir das nicht weiter geholfen.
Das ist meine Ordnerstruktur.
Code:
-application
|_modules
|_vita
|_controllers
|_IndexController.php
-data
-docs
-library
|_ND
||_Model
| |_Vita
| |_Vita.php
|_Zend
-public
-tests
PHP:
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
...
protected function _initAutoloader()
{
$loader = Zend_Loader_Autoloader::getInstance();
$loader->registerNamespace('ND_');
return $loader;
}
...
}
Code:
[production]
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = "Application"
; automatic loading of libraries
autoloaderNamespaces[] = "ND_"
phpSettings.date.timezone = "Europe/Berlin"
;resources.frontController.controllerDirectory = APPLICATION_PATH "/modules/index/controllers"
;resources.frontController.params.displayExceptions = 0
;appnamespace = "Application"
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
resources.frontController.params.prefixDefaultModule = true
resources.frontController.defaultModule = "index"
resources.frontController.throwerrors = false
resources.frontController.params.displayExceptions = 0
; resources (modules)
resources.modules[] = ""
resources.view[] = ""
; resources (layout)
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts"
resources.layout.layout = "main"
; db settings
resources.db.adapter = "PDO_MYSQL"
resources.db.isDefaultAdapter = true
resources.db.params.host = "localhost"
resources.db.params.username = "root"
resources.db.params.password = ""
resources.db.params.dbname = "nd"
[staging : production]
[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1
Das ist der Controller in dem ich versuche die "Vita" Classe zu instantiieren.
Ich erholte aber immer diesen Fehler: "Fatal error: Class 'ND_Model_Vita_Vita' not found in C:\xampp\htdocs\ND\application\modules\vita\controllers\IndexController.php on line 17"
PHP:
class Vita_IndexController extends Zend_Controller_Action
{
public function init()
{
$this->view->headTitle('Vita');
}
public function indexAction()
{
/* Just to try if the Loader is working for the Zend library -> it works */
$this->newForm = new Zend_Form();
$this->mdlVita = new ND_Model_Vita_Vita();
Zend_Registry::get('log')->info($this->mdlVita->test());
}
}
PHP:
class ND_Model_Vita_Vita
{
public function test()
{
return 'Is working';
}
}
Ich bin für alle Hinweise Dankbar.
EDIT: Ich habe das Problem etwas eingrenzen können. Ich hab das Projekt mal zu einer Live Umgebung geschoben und da hat alles funktioniert. Es muss also an meiner xampp Umgebung liegen.
Zuletzt bearbeitet: