开发者

Problem getting Params in injected controller Zend Framework

I have a layout 'profile'

<div>
    <div> $this->action(action1, controller1, module1)<开发者_JS百科;div>
    <div> $this->layout()->content </div>
    <div> $this->action(someotheraction, soController,soModule );
</div

And the problem starts when I want to get the $request->Params() from the action1 , controller1 module1 , it is empty. I looked at the code of a helper Action , it does accept as a 4th parameter Params, but then I will have to set it somewhere in the layout - which is not good. Basically what are the recommendations of guru people that are pretty professional with zend Framework. Maybe I should do some work around or should change the concept of how I am injecting additional Controller(module) actions


If you want to get the current Request object in the View, you can either inject it to the View from the controller or get it from the Front Controller via

$request = Zend_Controller_Front::getInstance()->getRequest();

The above is how the Action helper gets it itself.

Any argument, including $params, set to the action method of Action Helper will be set to the current Request object before it is dispatched. The Request will go through the entire dispatch cycle again, which is slow and why the Action Helper is generally avoided. The Action Helper will return (but not output) the body of the Response.

Not sure if that answers your question though.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜