Thanks Jude A
Your response, I believe is the way to go. But I modified it just a bit
because I was worried that I was doubling up on creating a router in my
bootstrap and in the controller when it was dispatched.
$router = $frontController->getRouter(); // router is a singleton
$request = new Zend_Controller_Request_Http();
$router->route($request);
// run
$frontController->dispatch($request);
Thanks all
David Procak
santouras wrote:
>
> I'm not sure if this is what you were aiming to do, but this sounded like
> a similar problem I was tackling. I wanted to know what module was going
> to be used before I dispatched as there would be varying requirements for
> each. In my case it is the difference between an admin section and a
> client section. Using this code let me see what the current module is.
>
>
>
> //Create a router and request object
> $router = new Zend_Controller_Router_Rewrite();
> $request = new Zend_Controller_Request_Http();
>
> $router->route($request);
>
> echo $request->getModuleName();
>
>
> I hope this helps you out
> -Jude A.
>
>
> On Fri, 16 Mar 2007 13:20:17 +0900, david pr <[EMAIL PROTECTED]> wrote:
>
>>
>> Hi,
>>
>> I am trying to use modules. It is "half" successful - my controllers are
>> being found in the appropriate directory - my problem is I want to set
>> the
>> view script path to the appropriate module but the module name is only
>> available after the front controller is "dispatched". I can see in
>> /Zend/Controller/Front.php that the module is set when the following
>> code is
>> executed in function dispatch():-
>>
>> $router->route($request);
>>
>> But I can't see how I can set up the router before dispatching. I don't
>> want
>> to set up my view's script path in every controller. I would like to do
>> it
>> in the bootstrap file. I can't see how I can easily do this. Find below a
>> snippet of my bootstrap file. Can someone help please?
>>
>> version 0.8.0
>>
>> index.php (snippet)
>>
>> $module =$frontController->getRequest()->getModuleName(); /* returns
>> blank
>> */
>>
>> // initialize view
>> Zend::loadClass($viewClassName);
>> $view = new $viewClassName();
>> $view->setScriptPath("$module/application/views');
>> Zend::register('view', $view);
>>
>> // run
>> $frontController->dispatch();
>>
>> $module =$frontController->getRequest()->getModuleName(); /* returns
>> correct
>> module name */
>>
>
>
>
>
--
View this message in context:
http://www.nabble.com/Module-name-not-available-in-bootstrap-file-tf3412535s16154.html#a9561209
Sent from the Zend Framework mailing list archive at Nabble.com.