smarty
smarty copied to clipboard
Compilation error ?
Hello,
I had difficulty identifying a problem in a template. After reading the documentation I wonder if the behavior is normal or faulty.
$WXO_PRODUCT_CROSS and $WXO_PRODUCT_UP both have the value "".
The following code should not produce HTML output but it does. My error is a missing $ in the first condition.
{if isset($WXO_PRODUCT_CROSS) && WXO_PRODUCT_CROSS ne ''}
{if isset($WXO_PRODUCT_CROSS) && $WXO_PRODUCT_CROSS ne ''}
<a href="#tab-articles-complementaires">{t}Additional articles{/t}</a>
{/if}
{if isset($WXO_PRODUCT_UP) && $WXO_PRODUCT_UP ne ''}
<a href="#tab-articles-similaires">{t}Similar articles{/t}</a
{/if}
{$WXO_PRODUCT_CROSS}
{/if}
The resulting code compiled by Smarty is:
<?php if ((isset($_smarty_tpl->tpl_vars['WXO_PRODUCT_CROSS']->value)) && 'WXO_PRODUCT_CROSS' != '') {?>
instead of
<?php if ((isset($_smarty_tpl->tpl_vars['WXO_PRODUCT_CROSS']->value)) && $_smarty_tpl->tpl_vars['WXO_PRODUCT_CROSS']->value != '') {?>
Is it normal for "WXO_PRODUCT_CROSS" to be interpreted as a string instead of causing a compilation error?