Hi all, is there a way to specify that a specific Volt template has to be compiled statically to HTML and not converted to PHP code which runs on every execution? To better explain my intentions i'll show you what i'm trying to accomplish: i've written a form renderer volt template, that is just a for cicle, iterating over the form object producting the HTML. That is included every time i need to render a form in my "standard" way by a parent template, passing to it the form object: this is compiled by Volt in a simple PHP include of the renderer, which in turn is compiled in a plain PHP FOR LOOP.

The question: how can i ask Volt to inline the renderer template in parent, resolving the loop during compilation instead on every execution? Is there a way to precompile with Volt to produce a more efficient PHP template code? In my case i wish to avoid writing tons of pretty identical views to display forms and on the other hand i'd like to speed up the page rendering avoiding to loop over the form object's elements every time.

I hope my POV will be clear to you guys! Let me know how much impossible it is! :D

Regard Gianluca


Hi, Volt templates are compiled just once when they are accessed by the first time, after that, templates aren't processed by Volt until the original template has changed. You can cache the output to avoid processing the output every time: