title: Can I render view without returning it in action controller in zend framework 2?
body: <p>Now I am doing so:</p>
  
  <pre><code>public function indexAction() {
      ...
      $view = new ViewModel(array(
          'foo' =&gt; 'bar',
      ));
      return $view;
  }
  </code></pre>
  
  <p>The problem is that I want to do something after $view rendering and before layout rendering:</p>
  
  <pre><code>public function indexAction() {
      ...
      $view = new ViewModel(array(
          'foo' =&gt; 'bar',
      ));
      $layout = $this-&gt;layout();
  
      $layout-&gt;content = $view-&gt;render();
      ...
      // here I want to do some important action
      ...
      $html = $layout-&gt;render();
      return $this-&gt;getResponse()-&gt;setContent($html);    
  }
  </code></pre>
  
  <p>But there is no method render(). In ZF1 I could render view:</p>
  
  <pre><code>$view = new Zend_View($data);
  $html = $view-&gt;render($templateName);
  </code></pre>
  
  <p>How can I do that in ZF2?</p>