PHP Programming/Smarty templating system/Functions