2008年11月24日星期一

Re: [fw-mvc] Capture Full Output from Layout and Script

The layout is a plugin that runs after all actions in the request object have been successfully dispatched. So your best bet would be to write a similar plugin that runs after the layout. At that point, you should be able to get the entire page as a string by using $this->getResponse()->getBody() in your plugin.

Take a look at Zend_Layout_Controller_Plugin_Layout to see how and when it renders the layout.

-Hector


On Mon, Nov 24, 2008 at 5:06 PM, Dan Wilson <dan@acucore.com> wrote:
Hey all,

I'm trying to capture the output of an action (for passing to a PDF
rendering engine), but can't seem to get it all combined together.

I've tried the following code:

$content = $this->_helper->layout->render();

But that just gives me the rendered layout but no body.

Then I also tried this:

$this->render();
$content = $this->_response->getBody();

But that only gives me the rendered script.

How do I get it all put together?

Thanks,
-=Dan


没有评论: