XF 2.2 {$xf.options or $xf.options

Allan

Well-known member
Just to be sure, what is the correct code?

<xf:if is="{$xf.options.xfk_toolsbar_block2_link}">
or
<xf:if is="$xf.options.xfk_toolsbar_block2_link">

and

<xf:if is="{$xf.options.xfk_toolsbar_alert_enable_block2} && !{$_COOKIE.block2}">
or
<xf:if is="$xf.options.xfk_toolsbar_alert_enable_block2 && !$_COOKIE.block2">

Thank you for your help.
 
TL;DR: Both will work and are valid.

Long version:
Single curly brackets { } are commonly used to print the value of the encapsulated variable. They also support adding filters, e.g. {$myVar|number}, and can be used to resolve dynamic nesting, which can be important in if-statements, e.g. {$myArray.{$myKey}}. Double curly brackets {{ }} additionally allow code operations such as executing functions and primitive math operations, e.g. {{ $a + $b }}, {{ strlen($a) }}, etc. Single curly brackets can be nested into double curly brackets as well.

It's a bit intransparent, but basically a bunch of template tag parameters operate as if they lived inside double curly brackets, notably the ones for control operators such as if, elseif and foreach.
 
Back
Top Bottom