Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

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.



46.8k
Accepted
answer

I prefer Phalcon\Mvc\View\Simple for any views that are not tied to a controller action.



2.0k

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.