1

I have two functions within a controller. Action which it loaded after calling the controller indexAction() and private function which sets data to view called generateInvoice($id).

        public function indexAction() {
           $this->generateInvoice('48313');
           var_dump($this->view->tax); // prints tax, view has desired data
           $htmlcontent = $this->view->render();
           $this->setNoRender();
           var_dump($htmlcontent); // returns string '' (length=0)
         }

         private function generateInvoice($id) {
            $this->view->id = $id;
            $this->view->other_variables = $their_values;
            ...
         }

After calling this, Zend var dumps me just an empty string. However, when I remove $this->setNoRender();, my index.phtml file is loaded and everything renders just fine - unfortunately, not into my variable, but it gets printed on the screen, which I don't want.

I didn't find any hint online, why $htmlcontent = $this->view->render(); doesn't work in my case. Any ideas?

porkbrain
  • 720
  • 5
  • 16
  • 1
    I think this may be of help http://stackoverflow.com/a/10343738/1207346 – Dale Jun 08 '16 at 13:00
  • Yes, that was it. I thought that controller has link to the view script, obviously I was wrong. Thank you very much and sorry for such a trivial question. Should've tried this out sooner. – porkbrain Jun 08 '16 at 13:23

0 Answers0