Zend FR

Consultez la FAQ sur le ZF avant de poster une question

Vous n'êtes pas identifié.

#1 27-12-2009 18:47:15

sosnaim
Nouveau membre
Date d'inscription: 27-12-2009
Messages: 1

Routing Info (Création d'URL personnalisées)

Mon fichier index.php de bootstraps

//*********************************************************************************//
<?php

error_reporting(E_ALL|E_STRICT);
ini_set('display_errors', 1);
date_default_timezone_set('Europe/London');

// Define path to application directory
defined('APPLICATION_PATH')
    || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));

// Define application environment
defined('APPLICATION_ENV')
    || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));

// Ensure library/ is on include_path
/** set_include_path(implode(PATH_SEPARATOR, array(
   realpath(APPLICATION_PATH . '/../library'),
    get_include_path(),
)));*/

/** Zend_Application */
require_once "Zend/Loader.php";
Zend_Loader::registerAutoload();

require_once 'Zend/Application.php'; 

// Create application, bootstrap, and run
$application = new Zend_Application(
    APPLICATION_ENV,
    APPLICATION_PATH . '/configs/application.ini'
);



/** Routing Info **/

$FrontController = Zend_Controller_Front::getInstance();
$frontController->throwExceptions(true);
$frontController->setControllerDirectory('../application/controllers');
$Router = $FrontController->getRouter();
$Router->addRoute("artiststore",
                 new Zend_Controller_Router_Route
                 (
                     "artist/store",
                     array
                      ("controller" => "artist",
                      "action"     => "artistaffiliatecontent")
                   ));
                                                   
$application->bootstrap()->run();

//******************************************************************//
La route pour mon URL est http://localhost/artist/artistaffiliatecontent je veux la changer pour
http://localhost/artist/store j'ai ajouté les lignes dans index.php
$FrontController = Zend_Controller_Front::getInstance();
$frontController->throwExceptions(true);
$frontController->setControllerDirectory('../application/controllers');
$Router = $FrontController->getRouter();
$Router->addRoute("artiststore",
                 new Zend_Controller_Router_Route
                 (
                     "artist/store",
                     array
                      ("controller" => "artist",
                      "action"     => "artistaffiliatecontent")
                   ));

mais il me sort se message d'erreur

An error occurred
Page not found
Exception information:
Message: Action "store" does not exist and was not trapped in __call()

Stack trace:
#0 C:\ZF-1.8\library\Zend\Controller\Action.php(514): Zend_Controller_Action->__call('storeAction', Array)
#1 C:\ZF-1.8\library\Zend\Controller\Dispatcher\Standard.php(288): Zend_Controller_Action->dispatch('storeAction')
#2 C:\ZF-1.8\library\Zend\Controller\Front.php(936): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#3 C:\ZF-1.8\library\Zend\Application\Bootstrap\Bootstrap.php(77): Zend_Controller_Front->dispatch()
#4 C:\ZF-1.8\library\Zend\Application.php(303): Zend_Application_Bootstrap_Bootstrap->run()
#5 C:\wamp\www\loudbite\public\index.php(26): Zend_Application->run()
#6 {main}
  Request Parameters:
array(3) {
  ["controller"]=>
  string(6) "artist"
  ["action"]=>
  string(5) "store"
  ["module"]=>
  string(7) "default"
}

S.V.P J’ai besoin de votre aide

Hors ligne

 

#2 06-01-2010 18:14:12

ferdikam
Membre
Date d'inscription: 03-05-2009
Messages: 18

Re: Routing Info (Création d'URL personnalisées)

salut!
Je voudrais savoir si dans ton controller "artist"  ta créer l'action "artistaffiliatecontent"
puisque c'est ça qu'il ne retrouve pas dans l'url

Dernière modification par ferdikam (06-01-2010 18:16:02)

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