You can do it in a plugin or in the bootstrap. We currently do it in the
bootstrap but we will eventually move it to a plugin to hold the bootstrap
clean.

-----Ursprüngliche Nachricht-----
Von: Waigani [mailto:[EMAIL PROTECTED] 
Gesendet: Sonntag, 30. September 2007 22:30
An: fw-general@lists.zend.com
Betreff: Re: [fw-general] getRequest


Dear Matthew,

Thank you very much for the clear explanation. So if I want to add the
current module as a default variable of a route ($router->addRoute), should
I do this in a plugin?

Thanks,




Matthew Weier O'Phinney-3 wrote:
> 
> -- Waigani <[EMAIL PROTECTED]> wrote
> (on Thursday, 27 September 2007, 04:10 PM -0700):
>> $request  = Zend_Controller_Front::getInstance()->getRequest();
>> print_r($request);
>> 
>> in the bootstrap index.php prints nothing. 
> 
> Because it's not yet instantiated.
> 
> $front->dispatch() creates a request object if none has been set, which
> is why you don't need to create one typically. However, prior to that,
> unless you instantiate and attach your own, you won't get on back from
> getRequest().
> 
>> I've tried everyway I can think of to getModuleName() from the
>> bootstrap with no luck. I also tried $request = new
>> Zend_Controller_Request_Http(); $request->getModuleName();
> 
> It won't contain the module name until *after* routing. The request
> object, at initialization, is simply an encapsulation of the request
> environment, and doesn't know how to associate portions of itself with
> the module, controller, action, etc. The router makes those
> associations.
> 
> -- 
> Matthew Weier O'Phinney
> PHP Developer            | [EMAIL PROTECTED]
> Zend - The PHP Company   | http://www.zend.com/
> 
> 

-- 
View this message in context:
http://www.nabble.com/getRequest-tf4531440s16154.html#a12969724
Sent from the Zend Framework mailing list archive at Nabble.com.


Reply via email to