PHP Programming/smarty/functions