Is there any method for getting html content of a view in a controller? I am trying to send html email from ZF3,however, I have not find any method for fetching html content to controller.
I used controller render method,
$render = new PHPRenderer(); $render->render();
But the code stop execution after above code and load view. I need to set HTML content to Email body.
You just need to use
ViewRendererservice. So, just passing this service to your controller, then call it if you want to render the view.Example: I assume your controller name is
SendEmailController. So inFactoryyou need to retrieve theViewRendererservice, then pass it to controllerAnd code in the controller