Created
November 4, 2013 20:03
-
-
Save Saeven/7308410 to your computer and use it in GitHub Desktop.
Using TwigRenderer directly, to render a view script and capture its output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$viewModel = new ViewModel(); | |
$viewModel->setVariables( | |
array( | |
'reset_url' => $core->getCurrentSite() . "/reset/" . $reset_hash, | |
'ip_address' => $core::getIP(), | |
'promo_name' => $core->getPromotionName(), | |
) | |
); | |
/** | |
* Create a renderable script | |
*/ | |
$renderer = new TwigRenderer( | |
$this->getServiceLocator()->get('Zend\View\View'), | |
$this->getServiceLocator()->get('ZfcTwigEnvironment'), | |
$this->getServiceLocator()->get('ZfcTwigResolver') | |
); | |
$viewModel->setTemplate( 'model/view/script' ); | |
$html = $renderer->render( $viewModel ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment