Skip to content

{exp:stash:not_empty}

Mark Croxton edited this page Sep 18, 2013 · 3 revisions

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

{!-- Evaluate a native Stash variable --}
{if {exp:stash:not_empty name="my_variable"}}
	{my_variable}								
{/if}

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

{!-- Check *any* string or variable is not empty: --}
{if {exp:stash:not_empty:string}{my_string}{/exp:stash:not_empty:string}}
	Yes! {my_string} is not empty
{/if}

Parameters

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

Clone this wiki locally