php -> html refactor