Custom Smarty functions