Using PhpRenderer directly with child views in ZF2
When sending out e-mails in Zend Framework 2, I want to use view script templates such that I can leverage a layout for my various e-mail templates. The idea is that I have a layout which has the shared markup and echoes out content somewhere. Exactly how layouts work in general. To accomplish this, I am trying to add a child view model to my layout view model and render it with the PhpRenderer . public function someMethod() { $child = new ViewModel(); $child->setTemplate('test-template'); $layout = new ViewModel(); $layout->setTemplate('email-layout'); $layout->addChild($child, 'content');