We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

How to prevent previous controller layout to be rendered in email

I using similar functionality as in Vokuro te email a user public function getTemplate($name, $params)

public function getTemplate($controller, $action, $params)
{
    $parameters = array_merge([
        'publicUrl' => $this->config->application->publicUrl
    ], $params);

    return $this->view->getRender($controller, $action, $parameters, function ($view) {
        $view->reset();
        $view->setRenderLevel(View::LEVEL_ACTION_VIEW);
    });

    return $view->getContent();
}

But this main layout from my controller keeps being rendered which gives errors how can I prevent this? In my controller I did a $this->view->pick('controller/action') as I wanted to reuse a template from another controller. It seems that might be causing the issue.



2.9k

Thanks for the reply I already ended up solving it with Phalcon\Mvc\View\Simple. This works like a charm no need for complex anyways for the emails.