In a class file, I am trying to render a .phtml file into a variable and pass the HTML output of that .phtml file to a variable in another ViewModel. How do I do this in ZF2?
The code I have so far is, which doesn't really seem to work:
$layout = new ViewModel();
$layout->setTemplate('myPhtmlFile.phtml');
$layout->setTerminal(true);
$viewModel = new ViewModel();
$viewModel->setVariable('formBody', $layout);