Isset
issetReturns true if the variable(s) passed to it are different from null.
If multiple parameters are supplied then isset() will return true only if all of the parameters are not null.
PHP Syntax:
<?php
if(isset(mixed $var))
{
echo "SET";
}else{
echo "Not SET";
}
Examples: Usage in Tplix syntax
{* Using | to check variable set or not*}
{if $foo|isset}SET{else}not set or null{/if}
{* Using php function style to check variable set or not*}
{if isset($foo)}SET{else}not set or null{/if}
{* Assign 1 to $foo variable*}
{$foo=1}
{* Using | to check variable set or not*}
{if $foo|isset}SET{else}not set or null{/if}
{$bar=null}
{if isset($bar)}SET{else}not set or null{/if}
Output
not set or null
not set or null
SET
not set or null
Note that, doing:
{if $foo}{$foo}{/if}
..is the same as if you used:
{if $foo|isset}SET{else}not set or null{/if}
OR
{if isset($foo)}SET{else}not set or null{/if}