2008年11月26日星期三

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

On Mon, Nov 24, 2008 at 9:38 PM, Hector Virgen <djvirgen@gmail.com> wrote:
> 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.

I'm not getting very far with this.

There has to be a way to do this though.

I've tried two approaches. The first being trying to set the
Zend_Layout::_pluginClass to be my custom plugin (which extends
Zend_Layout_Controller_Plugin_Layout):

$this->view->layout()->setPluginClass('PDFGen');

That didn't seem to do anything.

Then I tried to just register it as a plugin:

$front = Zend_Controller_Front::getInstance();
$front->registerPlugin(new PDFGen());

The first problem is when I try to register the plugin, I can't set it
to run last because the normal layout is set to run last (stackIndex:
99). If I try to get it to run at 98, it hasn't done the rendering
from the Layout Plugin yet. Is there a way to re-order the stackIndex
of the plugins?

Or any other ideas?

-=Dan

没有评论: