2009-04-09 3 views
0

Ich bin dabei, meine bootstrap.php-Datei organisiert, aber nachdem ich alles in separate statische Methoden, kann ich keine Seite über Index-Controller laden. Z.B. wenn ich versuche,"Kein Standard-Modul definiert" -Fehler in Zend Framework App

http://localhost/zftutorial/login/index

ich

erhalten zu öffnen
Fatal error: Uncaught exception 'Zend_Controller_Dispatcher_Exception' with message 
'Invalid controller class ("Login_IndexController")' in C:\Program 
Files\VertrigoServ\www\library\Zend\library\Zend\Controller\Dispatcher\Standard.php:341 
Stack trace: #0 C:\Program 
Files\VertrigoServ\www\library\Zend\library\Zend\Controller\Dispatcher\Standard.php(255): 
Zend_Controller_Dispatcher_Standard->loadClass('IndexController') #1 C:\Program 
Files\VertrigoServ\www\library\Zend\library\Zend\Controller\Front.php(934): 
Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), 
Object(Zend_Controller_Response_Http)) #2 C:\Program 
Files\VertrigoServ\www\zftutorial\public\index.php(18): Zend_Controller_Front->dispatch() 
#3 C:\Program Files\VertrigoServ\www\zftutorial\public\index.php(138): Bootstrap::run() #4 
{main} thrown in C:\Program 
Files\VertrigoServ\www\library\Zend\library\Zend\Controller\Dispatcher\Standard.php on 
line 341 

und in meiner Bootstrap-Datei scheinen ich definiert zu haben, in dem Controller finden chould:

public static function setupFrontController() 
{ 
    self::$frontController = Zend_Controller_Front::getInstance(); 
    self::$frontController->throwExceptions(true); 
    self::$frontController->returnResponse(true); 
    self::$frontController->setBaseUrl('/zftutorial'); 

    self::$frontController->setControllerDirectory(
     array(
      'default' => self::$root . '../application/controllers', 
      'admin' => self::$root . '../application/controllers', 
      'index' => self::$root . '../application/controllers', 
      'login' => self::$root . '../application/controllers', 
      'user' => self::$root . '../application/controllers' 
     ) 
    ); 

    self::$frontController->setParam('registry', self::$registry); 

} 

Vielleicht hat es etwas mit Routing zu tun, aber meine App funktionierte gut mit implizitem Routing vor, z andere Controller haben auch gut funktioniert. WHat ist die Quelle des obigen Fehlers? Wie kann ich es testen/finden/reparieren?

Antwort

0

an Ihrem Stapel der Suche den Fehler verfolgen ist Ungültige Controller-Klasse („Login_IndexController“)

Dies deutet darauf hin, dass die Klasse Login_IndexController existiert nicht.

Sie sollten eine Datei namens IndexController.php im Controller-Verzeichnis des Login-Moduls haben. Die Struktur, die Sie gerade haben, wird nicht funktionieren, weil zwei Module keinen Controller mit dem gleichen Namen haben können. Ändern Sie die Struktur in

self::$frontController->setControllerDirectory(
     array(
      'default' => self::$root . '../application/modules/default/controllers', 
      'admin' => self::$root . '../application/modules/admin/controllers', 
      'index' => self::$root . '../application/modules/index/controllers', 
      'login' => self::$root . '../application/modules/login/controllers', 
      'user' => self::$root . '../application/modules/user/controllers' 
     ) 
    ); 

Erstellen Sie die IndexController.php in self :: $ root. '../application/modules/login/controllers und stellen Sie sicher, dass die Klasse Login_IndexController

heißt