We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

Render Level in Micro Views

I have a problem setting render level for views in micro framework. For front page I want the the "default" render level, which is main layout > action view (I dont use controller layout). But for some ajax page I don't want to have any layout at all but still keep the view in the views directory.

$app->get('getVideo/{id}', function($id) use($app) { //the AJAX
   echo $app['view']->getRender('main','video'); //I want this to only load "video.phtml" not "views/index.phtml" then "video.phtml"

$app->get('/', function() use($app) {
   header("Content-Type: text/html; charset=utf-8");
   echo $app['view']->getRender('main','front');

It keeps loading the main layout inside the 'video.phtml' on getVideo. What can I do?



I believe this might be the answer to your issue: https://docs.phalcon.io/en/latest/reference/views.html#picking-views