On 15 Jul 2009, at 14:50, Exception e wrote:
Well, I did, but then the $output becomes the layout only, without its contents. What I need to capture is the whole layout, including its content. Pfew, this use case shouldn't be so difficult, but I am quitte puzzled?
calling
$this->_helper->ViewRenderer->render();
should influence
//render the layout manually and capture the output
$output = $this->view->render(path/to/layout.phtml);
but it doesn't. Unfortunately, zend_layout is a bit of black magic.
Okay, let's have another go. Zend_Layout's not magic. It's just particular. (And I'm trying to remember how it works without looking. :-)
The idea behind this:
$this->_helper->ViewRenderer->render()
was to get the content of the current action's view script into the Response object so that when you render the layout manually, the bit which goes:
echo $this->layout()->content;
has something to work on. That you're just getting the layout suggests that something has gone wrong.
The old fashioned way of doing all this would be:
$response = $this->getResponse();
$response->appendBody($this->view->render(path/to/view/script.phtml));
You could try that.
没有评论:
发表评论