added conditions and changed views to use php extension