smarty
smarty copied to clipboard
Containment operators
Support for:
{if $i in [1, 2, 3]}...{/if}
and
{if $j not in [1, 2, 3]}...{/if}
This could be extended to strings as well: {if 'im' in $name}..{/if}
I like this idea a lot... Would it also work for:
{if $needle in $haystack_array}
@scottchiefbaker yes
It seems Smarty v5 also supports in_array as a function. (implemented as FunctionHandler.) This is undocumented.
Wow, this is funny. From the changelog in 2009: - added {if 'expression' is in 'array'} syntax
This is undocumented, and we do not have {if 'expression' is not in 'array'} yet.