wucdbm / twig-defer-extension
Defer rendering of TWIG template pieces
Installs: 7 021
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=7.0
- twig/twig: ~2.7|~3.0
README
Using this small library you can "cache" the output of twig code and print it later.
Use the {% defer %} tag to cache your output. Both {% defer NAME EXPRESSION %} and {% defer NAME %} EXPRESSION {% enddefer %} are possible.
{% defer 'someKey' 'defaultValueExpression' %}
{% defer someKeyVariable 'someDefaultValueExpression' %}
{% defer 'someKey' %}
someBlock {{ with Variables }}
{% enddefer %}
{% if 'someKey' is deferred %}
{% if someVariableValue is deferred %}
{{ someKey|deferred('defaultValue') }}