-- debussy007 <[EMAIL PROTECTED]> wrote
(on Saturday, 29 September 2007, 02:48 AM -0700):
> 
> I am so hopeless I started debugging the source.
> 
> When I am about to dispatch, in the 
> "protected function _translateSpec($spec, array $vars = array())"
> The variables have the following values :
> 
> $spec :controller/:action.:suffix     
> $controller   auth    
> $action       index   
> $module       partners    <=== AS you can see it finds the module I specify in
> forward
> $suffix       phtml   
> $moduleDir    ./application/modules\\partners 
> $value        auth/index.phtml        
> 
> And in this method "$value" is returned, it doesn't seem to have the module
> in it,
> though the method finds the module partners.
> So I thought maybe it's because of this $spec variable which doesn't take
> module into the string,
> but I looked into the different possible specs in the ViewRenderer.php and
> there is only :
> protected $_viewScriptPathNoControllerSpec = ':action.:suffix';
> protected $_viewScriptPathSpec = ':controller/:action.:suffix';
> protected $_viewBasePathSpec = ':moduleDir/views';

_forward() has nothing to do with the ViewRenderer. 

The above paths are correct as they are used to form the paths to *view
scripts*. You'll notice that the view base path uses the module to set
the view script directory, and then the controller and action to
determine the actual script name within that directory.

_forward() is completely unrelated to the ViewRenderer; it simply tells
the dispatch loop that there is another action to dispatch.

I use _forward() all the time, and have been unable to reproduce the
issues you are having. 

The exceptions you're getting indicate that you're not creating a views
subdirectory in the module to which you are forwarding, however, which
means that the ViewRenderer has to fall back to the original paths
set... and cannot find the view scripts for the current action.

Make sure you are creating your directory structure correctly. Each
module should have this structure:

    <module>/
        controllers/
        views/
            scripts/
                <controller>/           // one dir for each controller
                    <action>.phtml      // view script for each action


> debussy007 wrote:
> > 
> > Hello,
> > 
> > Whenever I try to forward to another module, 
> > it keep trying to find the action/controller inside the current module.
> > It's like it doesn't consider the third parameter of _forward method,
> > which specifies the module.
> > 
> > e.g. with this code in the "default" module : 
> > 
> > $this->_forward('index','auth','partners');
> > return;
> > 
> > I have the following error : 
> > 
> > Uncaught exception 'Zend_View_Exception' with message 'script
> > 'auth/index.phtml' not found in path
> > (.\application\modules\default\views\scripts\)'
> > 
> > As you see it tries to find the action/controller in default module, even
> > if I specified to find it in the "partners" module.
> > 
> > My application structure is the following :
> > 
> > - application
> > |-- modules
> >     |--- admin
> >            |--- controllers
> >            |--- models
> >            |--- views
> >     |--- default
> >            |--- controllers
> >            |--- models
> >            |--- views
> >     |--- partners
> >            |--- controllers
> >            |--- models
> >            |--- views
> > 
> > I have the following in my bootstrap :
> > 
> > error_reporting(E_ALL|E_STRICT);
> > date_default_timezone_set('Europe/Brussels');
> > ini_set('display_errors', true);
> > ini_set('include_path', ini_get('include_path') 
> >     . PATH_SEPARATOR . './library'
> >     . PATH_SEPARATOR . './application/modules/default/models/'
> >     . PATH_SEPARATOR . './application/modules/partners/models/'
> >     . PATH_SEPARATOR . './application/helpers/');
> > [...]
> > $front = Zend_Controller_Front::getInstance();
> > $front->addModuleDirectory('./application/modules');
> > $front->setBaseUrl($config->baseUrl);
> > if($config->test) 
> >     $front->throwExceptions(true);
> > $front->dispatch();
> > 
> > Thank you for any help!

-- 
Matthew Weier O'Phinney
PHP Developer            | [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/

Reply via email to