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

Get a blank page after run view getrender


I try to create email template to user to edit the template and see the preview, I will show 2 variable which is $template that get a collect-review.volt content and $template-rendered that rendered by volt engine to display the preview.

After run getRender, I get a blank page. Is it possible to do this?

public function getTemplate()
            $params = array();
    $parameters = array_merge(array(
        'name' => 'myname',
    ), $params);

    return $this->view->getRender('emailtemplates', 'collect_review', $parameters, function($view){


public function collectTemplateAction()
         $auth = $this->session->get('auth');
         $shop = Shops::findByOwner($auth[id]);
         $this->view->setVar("shop", $shop);
         $this->view->setVar("name", 'warut');

         $template = file_get_contents('../apps/frontend/views/emailtemplates/collect-review.volt');

         $template_rendered = $this->getTemplate();
         //echo 'aa'.$template_rendered;

         $this->view->setVar("template", $template);
         //$this->view->setVar("template_rendered", $template_rendered);


edited Apr '15

by the way if you use phalcon model and you wrote wrong syntax it will not render anything so i guess

$shop = Shops::findByOwner($auth[id]); change it to $shop = Shops::findFirstByOwner($auth[id]);

follow phalcon 's document https://docs.phalcon.io/en/latest/reference/models.html

p.s sorry for my bad english and i can't post mark down I don't know why :(


Hello xeleniumz, thanks for your reply but $shop is working well (get all shops with user id). If I comment $template_rendered = $this->getTemplate() to skip running getTemplate function page will display normally but after run getTemplate (running $this->view->getRender) my page not return anyting.

edited Apr '15

thank you for new knowledge , I just know we can get all query which findby haha , ok may be the problem is from your render function , try to disable some layout and render replace it https://docs.phalcon.io/en/latest/reference/views.html#disabling-render-levels

In my case if i want to hierarchical rendering with other layout I did like this

my controller

    use Phalcon\Mvc\View;
    class TopupController extends ControllerBase {
    public function initialize() {
    public function indexAction(){


and in my view

    <?php $this->partial("topup/header") ?>
    <?php $this->partial("topup/footer") ?>

hope this answer may be your guidline p.s. sry for my bad english but I try to help you :)