Consultez la FAQ sur le ZF avant de poster une question
Vous n'êtes pas identifié.
Bonjour,
J'essaye désespéramment de réussir à afficher une page qui ne soit pas d'erreur et je ne vois pas comment trouver la solution...
Pour apprendre le Zend, j'ai installé chez NUXIT sur un sous-domaine http://authentification.votrecoop.org/ l'application ZEND avec un .htacess :
AddHandler x-httpd-php5 .php AddType application/x-httpd-php5 .php RewriteEngine On # Only apply to URLs on this domain RewriteCond %{HTTP_HOST} ^authentification.votrecoop.org$ # Only apply to URLs that aren't already under folder. RewriteCond %{REQUEST_URI} !^/public/ # Don't apply to URLs that go to existing files or folders. RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # Rewrite all those to insert /folder. #RewriteRule ^(.*)$ /public/$1 # Also redirect the root folder. RewriteCond %{HTTP_HOST} ^authentification.votrecoop.org$ RewriteRule ^(/)?$ public/index.php [L]
et l'apllication.ini
[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" resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers" resources.frontController.params.displayExceptions = 0
cela semble fonctionner, mais j'ai systématiquement le fichier 404.phtml qui s'affiche (pourtant le controller se lance. Enfin...)
fichier index.
<?php /** * Fichier d'entrée de l'application. * * @package App */ //on définit le chemin de notre application define ( 'APPLICATION_PATH', realpath ( dirname ( __FILE__ ) . '/../' ) ); //on définit le chemin de notre librairie $library = APPLICATION_PATH. '/library'; set_include_path ($library . PATH_SEPARATOR . get_include_path ()); echo "<br>"; echo "<br>"; echo "APPLICATION PATH : ".APPLICATION_PATH; echo "<br>"."library : ".$library; echo "<br>"; echo "<br>"; require_once 'Zend/Loader/Autoloader.php'; $loader = Zend_Loader_Autoloader::getInstance(); $loader->registerNamespace('App_'); //On charge les classes à utiliser ; Zend_Loader::loadClass ( 'Zend_Controller_Front' ); try { //getInstance() est utilisé pour récupérer une instance du contrôleur frontal. $front = Zend_Controller_Front::getInstance(); //le contrôleur frontal renvoie les exceptions qu'il a rencontrées //à l'objet de réponse, nous offrant une possibilité élégante de les gérer. $front->throwExceptions(true); //setControllerDirectory() est utilisé pour //chercher les fichiers de //classes de contrôleurs d'action. $front->setControllerDirectory(APPLICATION_PATH . '/application/controllers'); //Dispatch lance notre application, fait le gros travail du contrôleur frontal. //Il peut facultativement prendre un objet de requête et/ou un objet de réponse, //permettant ainsi au développeur de fournir des objets personnalisés. $front->dispatch(); //Traite les exceptions du contrôleur (généralement 404) } catch (Zend_Controller_Exception $e) { include 'errors/404.phtml'; //Traite les autres exceptions du contrôleur } catch (Exception $e) { include 'errors/500.phtml'; } // affiche de Hello Zend framework avec la date du jour require 'Zend/Date.php'; $date= new Zend_Date(); echo "<br><br>Hello Zend Framework, nous sommes le ".$date;
Je ne sais pas comment faire. Si vous avez une idée, je suis preneur.
Hors ligne
Bonsoir,
J'ai essayé d'avancer sur la réponse et j'ai réussi à "extraire" l'exeption :
Zend_Controller_Dispatcher_Exception Object ( [_previous:private] => [message:protected] => Invalid controller specified ( index ) [string:private] => [code:protected] => 0 [file:protected] => /web/votrecoop/authent/library/Zend/Controller/Dispatcher/Standard.php [line:protected] => 248 [trace:private] => Array ( [0] => Array ( [file] => /web/votrecoop/authent/library/Zend/Controller/Front.php [line] => 955 [function] => dispatch [class] => Zend_Controller_Dispatcher_Standard [type] => -> [args] => Array ( [0] => Zend_Controller_Request_Http Object ( [_paramSources:protected] => Array ( [0] => _GET [1] => _POST ) [_requestUri:protected] => / [_baseUrl:protected] => [_basePath:protected] => [_pathInfo:protected] => / [_params:protected] => Array ( [controller] => index [action] => index [module] => default ) [_rawBody:protected] => [_aliases:protected] => Array ( ) [_dispatched:protected] => 1 [_module:protected] => default [_moduleKey:protected] => module [_controller:protected] => index [_controllerKey:protected] => controller [_action:protected] => index [_actionKey:protected] => action ) [1] => Zend_Controller_Response_Http Object ( [_body:protected] => Array ( ) [_exceptions:protected] => Array ( ) [_headers:protected] => Array ( ) [_headersRaw:protected] => Array ( ) [_httpResponseCode:protected] => 200 [_isRedirect:protected] => [_renderExceptions:protected] => [headersSentThrowsException] => 1 ) ) ) [1] => Array ( [file] => /web/votrecoop/authent/public/index.php [line] => 51 [function] => dispatch [class] => Zend_Controller_Front [type] => -> [args] => Array ( ) ) ) )
Cela manque de clarté pour moi...
Dernière modification par Renard9 (24-10-2013 23:04:30)
Hors ligne
Re
La réponse est dans
[_previous:private] => [message:protected] => Invalid controller specified ( index )
Le controller doit s'appeler indexController et j'avais IndexController...
Finalement, c'est simple... Mais je n'ose pas renommer indexController en IndexController
Dernière modification par Renard9 (24-10-2013 23:02:25)
Hors ligne