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

Volt won't recompile templates if the parent of the view changes

So I have a view the inherits from a layout.

I realized that whenever I change the parent, volt won't recompile the templates so refreshing the browser has no effect.

But as soon as I change the child view, everything works ok (it recompiles)

So it looks like volt is not checking the parent of the view to decide wether he needs to recompile the views.

Am I doing something wrong? Is it an expected behaviour? Maybe a bug?

Thanks for your help!



33.8k
Accepted
answer

From the docs:

By default, and for performance reasons, Volt only checks for changes in the children templates to know when to re-compile to plain PHP again, so it is recommended initialize Volt with the option ‘compileAlways’ => true. Thus, the templates are compiled always taking into account changes in the parent templates.

Try that.

My bad, I have overlooked that paragraph.

Thanks for pointing it out

From the docs:

By default, and for performance reasons, Volt only checks for changes in the children templates to know when to re-compile to plain PHP again, so it is recommended initialize Volt with the option ‘compileAlways’ => true. Thus, the templates are compiled always taking into account changes in the parent templates.

Try that.