generating the controller for the pages