How can you change the Volt\Compiler instance used by Engine\Volt?

In looking for a way to automatically and optionally insert the template name in an arbitrary format at the start and end of a compiled template, subclassing the Volt compiler seemed a promising approach. The volt engine has a getCompiler() method but not setCompiler(). How can the default template compiler instance be replaced by a custom one?

You have to extend \Phalcon\Mvc\View\Engine\Volt and implement setCompiler() method and then override engine. No way how to do that directly.



2.0k

Changing the volt compiler and adding an option to enable/disable template names in the generated templates is trivial so going that route, however regenerating 2.0.10 from zep is the stumbling block as zephir 0.8.0 reports syntax errors in the default phalcon zep sources, and there is no clue as to which version of zephir was used to produce the phalcon C code we've been using up to this point.