PHP view refactoring