Skip to content

{exp:stash:is_empty}

Mark Croxton edited this page Jan 16, 2014 · 3 revisions

Returns 1 or 0 depending on whether a variable is empty or not. Useful for conditionals.

{!-- Evaluate a native Stash variable --}
{if {exp:stash:is_empty name="my_variable"}}
	'my_variable' is empty								
{/if}

{!-- Evaluate a snippet (whether set by Stash or in EE) --}
{if {exp:stash:is_empty name="my_variable" type="snippet"}}
	'my_variable' is empty								
{/if}

{!-- Check *any* string or variable is empty: --}
{if {exp:stash:is_empty:string}{my_string}{/exp:stash:is_empty:string}}
	'my_string' is empty
{/if}

Parameters

Accepts the same parameters as {exp:stash:get}

Clone this wiki locally