getRender doesn't poduct any content for the second template.

Strange behaviour occured when running twice this function below, for 2 different templates.

getRender doesn't poduct any content for the second template.

when calling: getTemplate(template1) and getTemplate(template2) -> I get results for template1 not for 2

when calling: getTemplate(template2) then getTemplate(template1) -> I get results for template2 not for 1

Any reason ?

Here is the code: got from Vokuro at Github in the class Mail (extends Component)

    public function getTemplate($name, $params)
    {
        $mailview = $this->view ;

            $content =  $mailview->getRender('emailTemplates', $name, $params, function($view){
                $view->setRenderLevel(View::LEVEL_AFTER_TEMPLATE);
            }); 

        return $content;
    }



84.5k

Try registering the volt service this way:

/**
 * Setting up the view component
 */
$di->set('view', function() use ($config) {

    $view = new \Phalcon\Mvc\View();

    $view->setViewsDir($config->application->viewsDir);

    $view->registerEngines(array(
        ".volt" => function($view, $di) {
            return new \Phalcon\Mvc\View\Engine\Volt($view, $di);
        }
    ));

    return $view;
});