VOLT: Template EngineVolt 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. ImplementationVolt views are compiled in php which saves time to write php code manually. Activating Volt In this we register Volt in view component having extension .phtml. Options available in volt Option | Description | Default |
---|
compiledPath | A writable path where the compiled PHP templates will be placed | ./ | compiledExtension | An additional extension appended to the compiled PHP file | .php | compiledSeparator | Volt replaces the directory separators / and \ by this separator in order to create a single file in the compiled directory | %% | Stat | Whether Phalcon must check if exists differences between the template file and its compiled path | True | compileAlways | Tell Volt if the templates must be compiled in each request or only when they change | False | Prefix | Allows to prepend a prefix to the templates in the compilation path | Null | autoescape | Enables globally autoescape of HTML | False |
VariablesObject 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'] FiltersVariables 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: Filter | Description |
---|
abs | Applies the abs PHP function to a value. | Capitalize | Capitalizes a string by applying the ucwords PHP function to the value | convert_encoding | Converts a string from one charset to another | Default | Sets a default value in case that the evaluated expression is empty (is not set or evaluates to a falsy value) | escape | Applies Phalcon\Escaper->escapeHtml() to the value | escape_attr | Applies Phalcon\Escaper->escapeHtmlAttr() to the value | json_encode | Converts a value into its JSON representation | json_decode | Converts a value from its JSON representation to a PHP representation |
|