Richard Knop
Richard Knop

Reputation: 83695

How to get the complete HTML output of action inside controller?

Is there a way how I can get a complete HTML output of a controller action? Is there some method for that?

Thanks.

Upvotes: 1

Views: 2025

Answers (3)

StasM
StasM

Reputation: 11042

Action view helper may be useful, from the docs:

  <div id="sidebar right">
   <div class="item">
    <?php echo $this->action('list',
                             'comment',
                             null,
                             array('count' => 10)); ?>
   </div>
</div>

Of course, you can replace echo with storing the var or do it outside of the view script.

Upvotes: 2

Dan Grossman
Dan Grossman

Reputation: 52372

Scroll down to the very bottom of this page for an example:

http://zend-framework-community.634137.n4.nabble.com/howto-capture-action-output-stream-it-as-pdf-td671222.html

Upvotes: 2

RageZ
RageZ

Reputation: 27313

$html = $this->view->render('view.phtml');

I think you should be able to also get this by playing with the response object.

like :

$this->getResponse()->getBody();

Upvotes: 3

Related Questions