generic page creator function