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

View active render path not return to prev path after partial render

Hi.

I would like to collect currently rendered paths used events manager - from event "beforeRenderView" and "afterRenderView".

$eventsManager->attach('view:beforeRenderView', function(Event $event, $view) {
$msg = "before: {$view->getActiveRenderPath()}, {$view->getCurrentRenderLevel()}":
debug_message($msg);
});
$eventsManager->attach('view:afterRenderView', function(Event $event, $view) {
$msg = "after: {$view->getActiveRenderPath()}, {$view->getCurrentRenderLevel()}":
debug_message($msg);
})

Ok and i have view files like this:

  • home/index.volt (action_view)
  • layouts/home.volt (layout)
  • layouts/logged.volt (after_template_layout) - in this file I include partial "partials/test.volt"
  • index.bolt (main_layout)

In this case, my events output (i replace render level number to render level name):

before: "../home/index.volt", action_view
after: "../home/index.volt", action_view
before: "../layouts/home.volt", layout
after: "../layouts/home.volt", layout
before: "../layouts/logged.volt", after_template
before: "../partials/test.volt", after_template
after: "../partials/test.volt", after_template
after: "../partials/test.volt", after_template
before: "../index.volt", main_layout
after: "../index.volt", main_layout

We can see 2x "after test.volt". The problem is that the name of the currently rendered path not returned to previusly path, after render partial. On while render "layouts/logged.volt", engine render partial "partials/test.volt", and save path to "_currentRenderPath" property (of view object). After this, while the engine continues redner "layout/logged.volt", current render path property contains the previous (partial), not the current rendered path.

Should it work like this?

looks like an issue. Can you report it on github?



3.5k

I reported it to github - #13554.