Consultez la FAQ sur le ZF avant de poster une question
Vous n'êtes pas identifié.
Pages: 1
Bonjour,
Je développe une application, et je cherche à utiliser l'organisation Conventional Modular
Voici la structure de mes dossiers :
/application
/default
/controllers
/models
/views
/csc
/controllers
/models
/views
/www
/images
/scripts
/styles
index.php
/library
/Zend
/tmp
/sessions
/cache
Et voici mon code :
error_reporting(E_ALL|E_STRICT) ; date_default_timezone_set('Europe/London'); require_once 'Zend/Controller/Front.php'; $controller = Zend_Controller_Front::getInstance(); $controller->throwExceptions(true); $folders = array( 'default' => '..\\application\\default\\controllers', 'csc' => '..\\application\\csc\\controllers', ) ; // Set several module directories at once: // $controller->setControllerDirectory($folders) ; $controller->addModuleDirectory('..\\application'); set_include_path( '..\\application\default\models' . PATH_SEPARATOR . '..\\application\csc\models' . PATH_SEPARATOR . get_include_path() ) ; Zend_Controller_Front::run($folders['default']) ;
L'accès aux pages du contrôleur par défaut fonctionne, mais pas le module csc :
Fatal error: Uncaught exception 'Zend_Controller_Dispatcher_Exception' with message 'Invalid controller specified (csc)' in C:\xampp\htdocs\library\Zend\Controller\Dispatcher\Standard.php:193 Stack trace: #0 C:\xampp\htdocs\library\Zend\Controller\Front.php(911): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) #1 C:\xampp\htdocs\library\Zend\Controller\Front.php(224): Zend_Controller_Front->dispatch() #2 C:\xampp\htdocs\www\index.php(32): Zend_Controller_Front::run('..\application\...') #3 {main} thrown in C:\xampp\htdocs\library\Zend\Controller\Dispatcher\Standard.php on line 193
J'ai lu les messages sur le forum traitant de problèmes quasi identiques, mais je n'ai pas réussi à configurer le contrôlleur pour avoir un résultat sans erreur. N'étant pas famillier avec le framework Zend, je pense que j'ai du faire une erreur quelque part.
Merci.
Dernière modification par a.rodier (18-10-2007 12:10:18)
Hors ligne
Bonjour à tous.
J'apporte une réponse pour ceux que cela intéresse : Il fallait utiliser la méthode dispatch du controlleur, et non pas la méthode statique run.
Merci quand même.
$controller->dispatch() ;
Hors ligne
Pages: 1