Page 1 of 1

UDT to totally remove a variable

Posted: Wed Aug 20, 2014 10:55 am
by psy
I needed to remove a smarty assigned variable in some template logic - not just set its value to null. There is no plugin in CMSMS, at least to my knowledge, to do it. Solution was to create a UDT called 'clear_var'.

UDT:

Code: Select all

$smarty->clearAssign($params['var']);
and in my template:

Code: Select all

{clear_var var='myvar'}
This completely erased the variable, not just the assigned value.