2009年6月18日星期四

Re: [fw-mvc] How to render different actions?

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)
--
View this message in context: http://www.nabble.com/How-to-render-different-actions--tp24088905p24094490.html
Sent from the Zend MVC mailing list archive at Nabble.com.

没有评论: