ActionStack::actionToStack (it's the reference you use, not html
code).
In itself, actionStack does not render anything, it's just a hook that
automatically forward you request to provided action/controller/module
when no other forward is left.
=> 1. simply register your actions in reportAction:
$this->_helper->actionStack('anAction', 'aController', 'aModule')
->actionToStack('anotherAction', 'aController', 'aModule');
=> 2. then it depends on what you need to do and how you want to do it:
- register a forward to a third action dedicated at dumping content
into external file
- or use a plugin to do it
- or directly dump/append content into external file time at a time,
within each stacked action
...
I would use this approach. I hope that helps.
Remy
On Fri, Jun 19, 2009 at 9:03 AM, Bertrand
Chevrier<bertrand@therapyedge.com> wrote:
> In the reference guide, "Chapter 12. Zend_Controller", "12.8 Action
> Helpers", "Example 12.3. Adding a Task Using a Request Object"
> (http://framework.zend.com/manual/en/zend.controller.actionhelpers.html#zend.controller.actionhelpers.actionstack)
>
> I have not understood very well what is the utility of that helper, but
> isn't it what I need?
> If I do that:
>
> public function reportAction(){
>
> $myReportContent = '';
>
> $myReportPages = array(
> array('aModule', 'aController', 'anAction'), //page 1 of my
> report, the view related to the action is a Latex template
> array('aModule', 'aController', 'anOtherAction') //page 2 of my
> report
> );
>
>
>
> $request = clone $this->getRequest();
>
> $request->setActionName('anAction')
> ->setModuleName('aModule')
> ->setControllerName('aController')
> ->setParams(array('bar' => 'baz'));
>
> $myReportContent .= $this->_helper->actionStack($request);
>
>
> ...
>
> file_put_content($myReportContent, 'myfile.tex');
>
> ...
> }
>
> and in aModule/aController/anAction
> I will return $this->render();
>
> Am I in the right way ???
>
> Thanks a lot
>
> Bertrand
>
> MarkDNA a écrit :
>
> Bertrand Chevrier wrote:
>
>
> Hi,
>
> I would like to use Zend-Mvc to create a dynamic LaTeX documen. My
> problem is: how can I call some other module/controller/actions into an
> action, and get the result into a variable. Each one of the other
> module/controller/actions will represent a page of my LateX report and
> the main action will be called as a normal action (by the url).
> For example in my controller
>
> public function reportAction(){
>
> $myReportPages = array(
> array('aModule', 'aController', 'anAction'), //page 1 of my
> report, the view related to the action is a Latex template
> array('aModule', 'aController', 'anOtherAction') //page 2 of
> my report
> );
>
> // create my report and get the results into a variable
>
> file_put_content($myReportContent, 'myfile.tex');
>
> ....
>
> }
> This case applies to my report, but this is a more general question: how
> to call actions manually?
> I hope I'm clear, and I'm sorry for the English mistakes.
> thanks,
> Bertrand Chevrier
>
>
>
> I'll give a try at this. Undoubtedly one of the gurus will come and clean up
> my mistakes, but this should point in the right direction.
>
> $page1 = $this->_forward('anAction', 'aController', 'aModule');
> $page2 = $this->_forward('anotherAction', 'aController', 'aModule');
>
> Having a return value in those actions should keep them from trying to
> render, but you may need to add:
> $this->_helper->viewRenderer->setNoRender(true);
> to keep anAction and anotherAction from rendering.
>
> I have not tried this code, it's just a best guess.
>
> -Mark
>
>
>
> -----
> Mark Garrett
> DNA
> Arkadelphia, AR
> (Telecommuting to: Rogue River, OR)
>
>
没有评论:
发表评论