2

Is there a way to change the smarty core {if $foo} so that it uses the isset() and $foo|default:$foo2?

The reason I ask this is because I am getting PHP warning messages.

I understand that I can do {if isset($foo)} although it is a lot clean to write this without the isset().

John Magnolia
  • 16,769
  • 36
  • 159
  • 270

1 Answers1

4

within an {if} the expression should not throw any notices. (at least that was the case once)

you could write a simple prefilter that (with regular expressions) looks for "{if $foo}" and converts it to the equivalent {if !empty($foo)}.

If you feel you've hit a bug / need an enhancement, share your thoughts on the bug tracker.

rodneyrehm
  • 13,442
  • 1
  • 40
  • 56