bcosca / fatfree

A powerful yet easy-to-use PHP micro-framework designed to help you build dynamic and robust Web applications - fast!
2.66k stars 446 forks source link

@variable ?? '' #1276

Closed noxtras closed 6 months ago

noxtras commented 7 months ago

In the templating engine, I always have to do this: {{@var ?? ''}} Is there a way to have it done directly by F3? so even in php8.2 i can still just write {{@var}} ?

Thanks.

ikkez commented 7 months ago

The trick is to define all vars you try to use in a template. If there's no chance to ensure this, you could use the error control operator @ to skip reporting the missing variable, i.e. {{ @@var }}