Closed KarelWintersky closed 4 months ago
Used somewhere in templates like:
{if getenv('ENV_STATE') == 'dev'}
...
{else}
...
{/if}
The error message could have been clearer: you nees to register it as a modifier, not as a function.
It works. Thank you. Is it declared anywhere in documentation?
But it's is not a like modifier...
{if getenv('ENV_STATE') == 'dev'}
...
{else}
...
{/if}
I think modifiers are classed as both {$var|get_env} and {if get_env()}{/if}
if it was {getEnv} it would be a block not a modifier https://smarty-php.github.io/smarty/stable/api/extending/block-tags/
@KarelWintersky it's variant of modifier. see https://smarty-php.github.io/smarty/stable/designers/language-modifiers/#using-modifiers-in-expressions but I agree, it's not obvious and at first glance it looks like a mistake.
PHP 7.4, Smarty 4.5.1
then
returns:
but: