If I use a variable that hasn't been put into the scope, PHPTAL throws an exception. Is there any way of making PHPTAL fall back to graceful defaults, for example evaluating to false in a boolean context, to a blank in a string context, etc?
PHPTAL: graceful treatment of undefined variables
1k Views Asked by AudioBubble At
2
You can add "
| nothing
" to TALES expressions or useisset()
inphp:
expressions.If you have larger bit of code that relies on a certain variable, then use
exists:
modifier:If you want to fake existence of any variable, it can be done, but I don't recommend it (it will hide typos):