IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Zend Framework PHP Discussion :

Unable to render - resolver could not resolve to a file


Sujet :

Zend Framework PHP

  1. #1
    Candidat au Club
    Homme Profil pro
    Administrateur de base de données
    Inscrit en
    Avril 2013
    Messages
    5
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Maroc

    Informations professionnelles :
    Activité : Administrateur de base de données
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2013
    Messages : 5
    Points : 4
    Points
    4
    Par défaut Unable to render - resolver could not resolve to a file
    S'il vous plait j'ai crée un Module Pizza avec un view index.phtml, j'ai un probleme lorsque j'essaie d'accéder a cette view par l'url:
    http://localhost:8080/pizza/public/pizza.

    index.phtml est localisé dans C:\wamp\www\pizza\module\Pizza\view\pizza\pizza.

    voila l'erreur qui s'afficher:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    Zend\View\Renderer\PhpRenderer::render: Unable to render template "pizza/pizza/index"; resolver could not resolve to a file
     
     
    #0 C:\wamp\www\pizza\vendor\zendframework\zendframework\library\Zend\View\View.php(205): Zend\View\Renderer\PhpRenderer->render(Object(Zend\View\Model\ViewModel))
    #1 C:\wamp\www\pizza\vendor\zendframework\zendframework\library\Zend\View\View.php(233): Zend\View\View->render(Object(Zend\View\Model\ViewModel))
    #2 C:\wamp\www\pizza\vendor\zendframework\zendframework\library\Zend\View\View.php(198): Zend\View\View->renderChildren(Object(Zend\View\Model\ViewModel))
    #3 C:\wamp\www\pizza\vendor\zendframework\zendframework\library\Zend\Mvc\View\Http\DefaultRenderingStrategy.php(102): Zend\View\View->render(Object(Zend\View\Model\ViewModel))
    #4 [internal function]: Zend\Mvc\View\Http\DefaultRenderingStrategy->render(Object(Zend\Mvc\MvcEvent))
    #5 C:\wamp\www\pizza\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php(468): call_user_func(Array, Object(Zend\Mvc\MvcEvent))
    #6 C:\wamp\www\pizza\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php(207): Zend\EventManager\EventManager->triggerListeners('render', Object(Zend\Mvc\MvcEvent), Array)
    #7 C:\wamp\www\pizza\vendor\zendframework\zendframework\library\Zend\Mvc\Application.php(352): Zend\EventManager\EventManager->trigger('render', Object(Zend\Mvc\MvcEvent))
    #8 C:\wamp\www\pizza\vendor\zendframework\zendframework\library\Zend\Mvc\Application.php(327): Zend\Mvc\Application->completeRequest(Object(Zend\Mvc\MvcEvent))
    #9 C:\wamp\www\pizza\public\index.php(17): Zend\Mvc\Application->run()
    #10 {main}
    S'il vous plait, aidez moi a detecter l'erreur, et Merci d'avance.

    voila module.config.php:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    <?php
     
     return array( 
    			 'controllers' => array(
    			       'invokables' => array('Pizza\Controller\Pizza' => 'Pizza\Controller\PizzaController'),
    				   ), 
    			 'router' => array(
    			  		'routes' => array(
    							'pizza' => array(
    							          'type'=> 'segment', 
    									  'options' => array(
    															          'route' => '/pizza[/][:action][/:id]', 
     															          'constraints' => array(
    																					'action' => '[a-zA-Z][a-zA-Z0-9_-]*', 																																																				                                                                             		'id' => '[0-9]+'),
                                                                          'defaults' => array( 
    																				   'controller'=> 'Pizza\Controller\Pizza', 
    																				   'action' =>	'index'),	 												
    														)
    									       )
    							         )
    					             ),
                 'view manager' => array('template_path_stack' => array('pizza' => __DIR__.'/../view'),), 
    			 );
    et voila module.php:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    <?php
     
    namespace Pizza;
     
    class Module {
     
    	public function getAutoLoaderConfig()
    	{
    		return array(
    			'Zend\Loader\ClassMapAutoLoader' => array(__DIR__.'/autoload_classmap.php',),
    			'Zend\Loader\StandardAutoloader' => array(
    				'namespaces' => array(__NAMESPACE__ => __DIR__.'/src/'.__NAMESPACE__,),
    				),
    				);
    	}
     
    	public function getConfig()
    	{
    		return include __DIR__.'/config/module.config.php';
    	}
     
    }

  2. #2
    Membre actif
    Homme Profil pro
    Consultant informatique
    Inscrit en
    Juillet 2004
    Messages
    51
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France

    Informations professionnelles :
    Activité : Consultant informatique

    Informations forums :
    Inscription : Juillet 2004
    Messages : 51
    Points : 204
    Points
    204
    Par défaut
    Salut,

    A priori niveau config tout est bon.
    Après possible que t'es un petit problème de vhost, car la bonne URL serait http://www.monsite.local/pizza

    Je te conseil de donc de créer un vhost avec l'url de ton choix qui pointe vers la racine web (www)

    Ensuite tu modifies ton fichier hosts c:/Windows/System32/drivers/etc/hosts et tu ajoutes ceci :

    127.0.0.1 www.monsite.local
    127.0.0.1 monsite.local

  3. #3
    Candidat au Club
    Homme Profil pro
    Administrateur de base de données
    Inscrit en
    Avril 2013
    Messages
    5
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Maroc

    Informations professionnelles :
    Activité : Administrateur de base de données
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2013
    Messages : 5
    Points : 4
    Points
    4
    Par défaut
    J'ai testé et toujours le même problème
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    # For example:
    #
    #      102.54.94.97     rhino.acme.com          # source server
    #       38.25.63.10     x.acme.com              # x client host
     
    # localhost name resolution is handled within DNS itself.
    #	127.0.0.1       localhost
    #	::1             localhost
     
    127.0.0.1   www.pizza.local
    127.0.0.1	pizza.local
    127.0.0.1   localhost
    J'utilise le port 8080 pour wampserver et non 80

  4. #4
    Membre régulier Avatar de eaglesnipe
    Homme Profil pro
    Ingénieur Etudes et Développement
    Inscrit en
    Janvier 2008
    Messages
    75
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur Etudes et Développement
    Secteur : High Tech - Produits et services télécom et Internet

    Informations forums :
    Inscription : Janvier 2008
    Messages : 75
    Points : 76
    Points
    76
    Par défaut
    Bonjour,

    au vu de l'URL invoquée

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    http://localhost:8080/pizza/public/pizza
    je m'attends à avoir la structure suivante :

    • Module : Pizza
    • Controller : Public
    • Action : Pizza


    Or d'après ton path pour la vue

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    C:\wamp\www\pizza\module\Pizza\view\pizza\pizza
    tu es censé avoir l'arbo suivante :
    • Module : Pizza
    • Controller : Pizza
    • Action : Pizza


    Donc à moins que j'ai râté quelque chose, renomme ton controller ou ton répertoire de vue en conséquence. Pense à mettre à jour les invokables dans ta conf. selon tes modifs.

Discussions similaires

  1. could not resolve property
    Par *alexandre* dans le forum Hibernate
    Réponses: 1
    Dernier message: 30/10/2006, 13h44
  2. [Oracle] could not resolve service name
    Par navis84 dans le forum PHP & Base de données
    Réponses: 1
    Dernier message: 21/07/2006, 11h12
  3. [Database link] TNS:could not resolve service name
    Par sleepy2002 dans le forum Oracle
    Réponses: 3
    Dernier message: 07/03/2006, 05h22
  4. Réponses: 11
    Dernier message: 29/06/2005, 11h36
  5. TNS:listener could not resolve SERVICE_NAME given in connect
    Par Sinclair dans le forum Administration
    Réponses: 15
    Dernier message: 20/08/2003, 17h26

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo