How to pass a a view (file volt) to variable

How to pass a view file to an variable? Example: // emails/test.volt $htmlEmail = $this->view("emails/test");

echo $htmlEmail;


<H1>Hola enviando mensaje</H1>


if anyone has this problem too... i have the solution:

return $this->view->getRender('emails', $name, $params, function($view) {

where emails is the folders that contain templates, $name is the name of the template for attach and any $params to pass to the template

in this case i use this function to pass the view how template for email (swiftmailer)

    $mailer->subject(_('Ha ocurrido un error en el sistema'))
                ->message($mailer->template('senderror', array(
                            'siteName' => $this->config->client->siteName
                )->from(array($contact_email => $contact_company))->send(FALSE);