Capturing the output of another action as part of the current action?

I am trying to find a way to capture the output (visualized view) of another action in the current action ... something similar to output buffering.

The scenario is that I need to save a β€œsnapshot” of the report. The data used in the report is constantly changing, and for some reason I need to actually save the HTML representation, not just the data array. I created snapshotAction (), and I want to somehow capture the output of a separate reportAction () inside it. I do not want to display reportAction () on the screen, I want it to be displayed in my current action before the action completes.

Is there any way to do this in ZF?


Benedict Cohen answered correctly below, but I did not understand this until I saw this use in the archives of the ZF mailing lists: How to display several types of actions?

I use something similar:

public function snapshotAction () {
    $content = $this->view->action('run', 'report');
    ...etc...
}
+5
source share
2 answers

They see an assistant called "action" , which can be useful. You specify the controller, action and parameters, and it returns the result. The helper creates a new dispatch loop, so if you use it a lot, it can have performance implications (I'm not worried about performance until it is proven that it causes problems).

+7
source

. Zend_Cache , .

0

All Articles