I am working with smarty templates in PHP and I would like to know if there is a short expression for this:
{if isset($data.name)}{$data.name}{/if}
such as in php we have:
<?= $data->name?? '' ?>
I want a form field to hold the data when it does not pass a validation, like this:
<input type="text" id="inputName" name="name" placeholder="Name" autofocus value="{if isset($data.name)}{$data.name}{/if}">
Thanks in advance and best regards
you can use the default modifier to achieve a similar result to the null coalescing operator:
<input type="text" id="inputName" name="name" placeholder="Name" autofocus value="{$data.name|default:''}">