VOLT: Template Engine
Volt provides Phalcon fast execution as it is very fast and designer friendly templating language written in C for PHP. It has many helpers defined to write views. Volt is inspired by Jinja and written by Armin Ronacher.
Volt views are compiled in php which saves time to write php code manually.
In this we register Volt in view component having extension .phtml.
Options available in volt
||A writable path where the compiled PHP templates will be placed
||An additional extension appended to the compiled PHP file
||Volt replaces the directory separators / and \ by this separator in order to create a single file in the compiled directory
||Whether Phalcon must check if exists differences between the template file and its compiled path
||Tell Volt if the templates must be compiled in each request or only when they change
||Allows to prepend a prefix to the templates in the compilation path
||Enables globally autoescape of HTML
Object variables may have attributes which can be accessed using the syntax: foo.bar. If you are passing arrays, you have to use the square bracket syntax: foo['bar']
Variables can be formatted or modified using filters. The pipe operator (|) is used to apply filters to variables:
Following is the list of filters that can be used:
||Applies the abs PHP function to a value.
||Capitalizes a string by applying the ucwords PHP function to the value
||Converts a string from one charset to another
||Sets a default value in case that the evaluated expression is empty (is not set or evaluates to a falsy value)
||Applies Phalcon\Escaper->escapeHtml() to the value
||Applies Phalcon\Escaper->escapeHtmlAttr() to the value
||Converts a value into its JSON representation
||Converts a value from its JSON representation to a PHP representation