Layout rendering twice

Hello , i am performing an ACL check in my controller's initialize method and setting a layout regarding to role of authenticated user.

```php public function initialize(){ $role = $this->sezon->role ? $this->sezon->role : 'visitor' ; if($this->acl->isAllowed($role,$this->dispatcher->getControllerName(),$this->dispatcher->getActionName())){ switch($role){ case "Power" : $this->view->setLayout("power"); break; case "Visitor" ; $this->view->setLayout("visitor"); break; } return true; }else{ $this->response->redirect("admin/login/"); return false; }
} ``` This works fine controller wide , but when i try to run the code below ;

```php $this->view->render("somecontroller","someaction"); ```

it renders layout twice.

P.S : i tried to disable layout at "somecontroller" with no luck.



84.5k

In hierarchical mode, you don't have to call: render(), it's automatically called by Phalcon\Mvc\Application, that's why you're getting the output twice