php and smarty stuff (ugh)