...-tag. After the
closing tag, all declared variables are removed again.
= Examples =
{x}
{x.name} or {y}
Note: Using this view helper can be a sign of weak architecture. If you end up using it extensively
you might want to fine-tune your "view model" (the data you assign to the view).
/]]>
{f:cache.disable()}
Some output or Fluid code
Additional output is also not compilable because of the ViewHelper
/]]>
Is always evaluated also when compiled
Will only be evaluated once and this output will be
cached as a static string with no logic attached.
The compiled template will not contain neither the
condition ViewHelperNodes or the variable accessor
that are used inside this node.
This is also evaluated when compiled (static node is closed)
Also evaluated; is outside static node
/]]>
Template code depending on {foo} variable which is not
assigned when warming up Fluid's caches. {foo} is only
assigned if the variable does not already exist and the
assignment only happens if Fluid is in warmup mode.
/]]>
Before
This is completely hidden.
This does not get rendered
After
]]]]>
Note: Using this view helper won't have a notable effect on performance, especially once the template is parsed.
However it can lead to reduced readability. You can use layouts and partials to split a large template into smaller
parts. Using self-descriptive names for the partials can make comments redundant.
/]]>
{objects -> f:count()}
/]]>
{cycle}
Note: The above examples could also be achieved using the "iteration" argument of the ForViewHelper
/]]>
{object -> f:debug(title: 'Custom title')}
{object -> f:debug(typeOnly: true)}
Note: This view helper is only meant to be used during development
/]]>
condition was not true
/]]>
{foo}
- Index: {fooIterator.index} Cycle: {fooIterator.cycle} Total: {fooIterator.total}{f:if(condition: fooIterator.isEven, then: ' Even')}{f:if(condition: fooIterator.isOdd, then: ' Odd')}{f:if(condition: fooIterator.isFirst, then: ' First')}{f:if(condition: fooIterator.isLast, then: ' Last')}
/]]>
{string}
{string -> f:format.cdata()}
/]]>
{text}
{text -> f:format.htmlspecialchars(encoding: 'ISO-8859-1')}
/]]>
%.3e
%2$s is great, TYPO%1$d too. Yes, TYPO%1$d is great and so is %2$s!
We love %s
{someText -> f:format.printf(arguments: {1: 'TYPO3'})}
/]]>
{string}
{string -> f:format.raw()}
/]]>
{fruit.name}
Note: Using this view helper can be a sign of weak architecture. If you end up using it extensively
you might want to fine-tune your "view model" (the data you assign to the view).
/]]>, >= and %
The % operator converts the result of the % operation to boolean.
XX and YY can be one of:
- number
- Object Accessor
- Array
- a ViewHelper
Note: Strings at XX/YY are NOT allowed, however, for the time being,
a string comparison can be achieved with comparing arrays (see example
below).
::
Will be shown if rank is > 100
Will be shown if rank % 2 != 0.
Checks if rank is equal to the result of the ViewHelper "k:bar"
Will result true if {foo.bar}'s represented value equals 'stringToCompare'.
= Examples =
This is being shown in case the condition matches
This is being shown in case the condition matches.
This is being displayed in case the condition evaluates to FALSE.
{f:if(condition: someCondition, then: 'condition is met', else: 'condition is not met')}
/]]>
/]]>
This is a section. {foo}
/]]>
This is a section. {foo}
/]]>
/]]>
Mr.
Mrs.
Mr. / Mrs.
Note: Using this view helper can be a sign of weak architecture. If you end up using it extensively
you might want to consider restructuring your controllers/actions and/or use partials and sections.
E.g. the above example could be achieved with and the partials
"title.male.html", "title.female.html", ...
Depending on the scenario this can be easier to extend and possibly contains less duplication.
/]]> only has an effect inside of "IF". See If-ViewHelper for documentation.
/]]>some value
{oldvariable -> f:format.htmlspecialchars() -> f:variable(name: 'newvariable')}
{oldvariable}
/]]>