I have just finished switching the view from twig engine to volt. All works great. However, I have an email rendering component that twig was doing that I can't resolve now
I want to load the html email templates, render 3 variabls, and send it as body. The twig set up was like this:
$loader = new \Twig_Loader_Filesystem($this->config->application->viewsDir.'/mail'); $twig = new \Twig_Environment($loader); $template = $twig->loadTemplate($name); return $template;
The content of the html file is very basic:
Hello {{ user }},
Your password has been reset:
{{ base_url }}/resetPass/{{ newpass }}
Now, I tried so many way to do it using phtml and volt, but all failed. First I tried this, but it returns an empty value
$this->view->getRender($this->config->application->viewsDir . '/mail', $name, $params, function ($view) { $view->setRenderLevel(View::LEVEL_LAYOUT); }); return $this->view->getContent();
I also, tried this, but it returns and unchaged value as string.
$view = new SimpleView(); $view->setViewsDir($this->config->application->viewsDir); echo $view->render('mail/'.$name, array(
"user" => $user->firstName . ' ' . $user->lastName, "newpass" => $new_pass, "base_url" => 'https://' . $_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'] ));
I'm still using phalcon 2, but I'm going to upgrade as soon as I fixed this issue.
Any help, would be appriciated.