Zend FR

Consultez la FAQ sur le ZF avant de poster une question

Vous n'êtes pas identifié.

#1 03-11-2008 11:58:23

tim01
Membre
Lieu: saint didier surchalaronne
Date d'inscription: 24-10-2008
Messages: 44

[resolu][Zend_Loader] include_once

Bonjour,

[g]Déjà je précise que j'ai chercher avant de poster ![/g]

Alors voilà je suis entrain de créer mon espace membre avec ZF . Mais j'ai un petit souci :

Code:

Warning: Zend_Loader::include_once(users.php) [zend-loader.include-once]: failed to open stream: No such file or directory in /home/zftest/public_html/library/Zend/Loader.php on line 83

Warning: Zend_Loader::include_once() [function.include]: Failed opening 'users.php' for inclusion (include_path='.:./library:./application/models:.:/usr/local/lib/php') in /home/zftest/public_html/library/Zend/Loader.php on line 83

Fatal error: Uncaught exception 'Zend_Exception' with message 'File "users.php" does not exist or class "users" was not found in the file' in /home/zftest/public_html/library/Zend/Loader.php:88 Stack trace: #0 /home/zftest/public_html/application/controllers/AuthController.php(10): Zend_Loader::loadClass('users') #1 /home/zftest/public_html/library/Zend/Controller/Action.php(118): AuthController->init() #2 /home/zftest/public_html/library/Zend/Controller/Dispatcher/Standard.php(261): Zend_Controller_Action->__construct(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http), Array) #3 /home/zftest/public_html/library/Zend/Controller/Front.php(934): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) #4 /home/zftest/public_html/index.php(43): Zend_Controller_Front->dispatch() #5 {main} thrown in /home/zftest/public_html/library/Zend/Loader.php on line 88

Mais je comprend pas pourquoi y me demande une page users.php alors que jamais dans mon code je la demande :

AuthController.php

Code:

<?php

    class AuthController extends Zend_Controller_Action
    {
    
        function init()
        {
        
            $this->initView();
            Zend_Loader::loadClass('users');
            $this->view->baseUrl = $this->_request->getBaseUrl();
            $this->view->user = Zend_Auth::getInstance()->getIdentity();
            
        }
        function indexAction()
        {
        
            $this->_redirect('/');
            
        }
        function loginAction()
        {
        
            $this->view->message = '';
            
            if ($this->_request->isPost()) {
                Zend_Loader::loadClass('Zend_Filter_StripTags');
                $f = new Zend_Filter_StripTags();
                $username = $f->filter($this->_request->getPost('username'));
                $password = $f->filter($this->_request->getPost('password'));
                
                if (empty($username)) {
                    $this->view->message = 'S\'il vous plait fournir un nom d\'utilisateur !';
                } else {
                    Zend_Loader::loadClass('Zend_Auth_Adapter_DbTable');
                    $dbAdapter = Zend_Registry::get('dbadapter');
                    $authAdapter = new Zend_Auth_Adapter_DbTable($dbadapter);
                    $authAdapter->setIdentityName('users');
                    $authAdapter->setIdentityColumn('username');
                    $authAdapter->setCredentialColumn('password');
                    
                    $authAdapter->setIdentity($username);
                    $authAdapter->setCredencial($password);
                    
                    $auth = Zend_Auth::getInstance();
                    $result = $auth->authenticate($authAdapter);
                    
                        if ($result->isValid()) {
                            $data = $authAdapter->getResulRowObjet(null, 'password');
                            $auth->getStorage()->write($data);
                            $this->_redirect('/');
                        } else {
                            $this->view->message = 'Echec de la connexion !';
                        }
                }
            }
            $this->view->title = "Connetez-vous !";
            $this->render();
        }
        function logoutAction()
        {
            
            Zend_Auth::getInstance()->clearIdentity();
            $this->_redirect('/');
        
        }
    }
?>

et login.phtml

Code:

<center>
                <img src="<?php echo $this->baseUrl(); ?>/public/images/headerbeta.jpg" title="La Lyre en D&eacute;lire" href="<?php echo $this->url(array('controller'=>'index', 'action'=>'index')); ?>" />
            </center>
                <div id="menu">
                    <a href="<?php echo $this->url(array('controller'=>'index', 'action'=>'index')); ?>">Accueil</a> <a href="<?php echo $this->url(array('controller'=>'historique', 'action'=>'historique')); ?>">Histoire</a> <a href="<?php echo $this->url(array('controller'=>'trombinoscope', 'action'=>'trombinoscope')); ?>">Trombinoscope</a> <a href="<?php echo $this->url(array('controller'=>'repertoire', 'action'=>'repertoire')); ?>">R&eacute;pertoire</a> <a href="<?php echo $this->url(array('controller'=>'calendrier', 'action'=>'calendrier')); ?>">Calendrier</a> <a href="<?php echo $this->url(array('controller'=>'contacter', 'action'=>'contacter')); ?>">Contact</a>
                </div>
                    <div id="page">
                    
                    <?php if(!empty($this->message)) ?>
                        <div id="message">
                            <?php echo $this->escape($this->message); ?>
                        </div>
                    <?php endif; ?>
                    <form action="<?php echo $this->baseUrl(); ?>/auth/login" method="port">
                        <div>
                            <label for="username">Pseudo :</label>
                            <input type="text" name="username" value="" />
                        </div>
                        <div>
                            <label for="password">Mots de passe :</label>
                            <input type="password" name="password" value="" />
                        </div>
                        <div id="formbutton">
                            <input type="submit" name="login" value="Connection" />
                        </div>
                    </form>
            </div>
            <div id="copyright">
            .:! &copy; tiim-zero1 !:. .:! Design by <a href="mailto:tim01@hotmail.fr">Timoth&eacute;</a> pour <a href="<?php echo $this->url(array('controller'=>'index', 'action'=>'index')); ?>">La Lyre en d&eacute;lire</a> !:. .:! Tout droit r&eacute;serv&eacute; !:.
            </div>
            </div>

Si vous voulez tester ces ici

Dernière modification par tim01 (03-11-2008 12:08:58)

Hors ligne

 

#2 03-11-2008 12:03:10

tonton flubb
Membre
Date d'inscription: 11-10-2008
Messages: 48
Site web

Re: [resolu][Zend_Loader] include_once

Salut,

Code:

function init() {
       $this->initView();
       Zend_Loader::loadClass('users');
       $this->view->baseUrl = $this->_request->getBaseUrl();
       $this->view->user = Zend_Auth::getInstance()->getIdentity();     
}

Dans ta méthode Init tu demande au Zend_Loader du charger la classe users. C'est donc normal qu'il t'informe qu'il ne trouve pas le fichier users.php

Soit il faut supprimer cette ligne si elle ne te sert pas, soit il faut modifier l'emplacement de ce fichier.


Florent - Développeur Web

Hors ligne

 

#3 03-11-2008 12:04:09

nORKy
Membre
Date d'inscription: 06-03-2008
Messages: 1098

Re: [resolu][Zend_Loader] include_once

C'est aussi gros que le nez sur la figure ..

Code:

#0 ... /AuthController.php(10): Zend_Loader::loadClass('users')
#1 ... /Action.php(118): AuthController-&gt;init()

ligne 10, dans ta fonction init :

Code:

Zend_Loader::loadClass('users');

Il cherche a chargé une classé nommé User.
Comme il ne connait pas la classe, il tente te trouvé un fichier (portant son nom) de la chargé.


----
Gruiiik !

Hors ligne

 

#4 03-11-2008 12:05:47

tim01
Membre
Lieu: saint didier surchalaronne
Date d'inscription: 24-10-2008
Messages: 44

Re: [resolu][Zend_Loader] include_once

Merci sa marche !

J'ai chercher de partout et pourtant j'ai pas trouver merci beaucoup !

Hors ligne

 

Pied de page des forums

Propulsé par PunBB
© Copyright 2002–2005 Rickard Andersson
Traduction par punbb.fr

Graphisme réalisé par l'agence Rodolphe Eveilleau
Développement par Kitpages