-
Notifications
You must be signed in to change notification settings - Fork 7
JTwig
Kvantum supports JTwig templates by default.
In .kvantum/config/server.yml
edit
templates:
engine: !!com.github.intellectualsites.kvantum.api.config.CoreConfig$TemplatingEngine 'JTwig'
It is possible to render JTwig templates using the built in views. It is recommended to use either the HTML or Standard view when dealing with JTwig.
It is required to explicitly turn off caching for the view when rendering JTwig templates. It is still possible to allow for file caching, however. This means that the template is stored in the cache, whilst the response isn't (as it is pseudo-dynamic). This can be done by adding a view option:
cacheApplicable: false
It is possible to match .html requests to .twig using the extensionRewrite
view option. This is useful when
using the default view, and allowing for the extension variable. An example of this is:
extensionRewrite:
html: twig
It is also possible to direct request to .twig files directly, by using a filePattern:
filePattern: ${file}.twig
views:
index:
filter: '[file=index].html'
options:
filePattern: ${file}.twig
folder: ./public
cacheApplicable: false
type: html
views:
std:
filter: '[file=index].[extension=html]'
options:
filePattern: ${file}.${extension}
folder: ./public
excludeExtensions:
- txt
extensionRewrite:
html: twig
type: std
IntellectualServer
Files can be found in .kvantum/config
- Getting Started
- View Patterns
- File Patterns
- server.yml
views.yml- socketFilters.yml
- translations.yml
- SSL
- Getting Started
- Modules
- Hello World
- Plugins
- Events
- Account System
- Authorization
- Application System
- Sessions
- Create a view - OOP based
- Create a view - @Annotation based
- Middleware
- Extending Crush (Templating syntax)
- ViewReturn