I have managed to get the agency I work for to try out Codeigniter and using it on a number of projects but our 4 developers (including myself) can’t agree on the best (cleanest and most efficient way) of having multiple parent controllers.
What we are trying to do is have a parent controller for frontend, admin and in some occasions member/client areas so in all 3 controllers with sub controllers that extend each. The purpose is to pass global information such as navigation, footer info and sessions etc withough having to included it in each controller.
The 3 different things we have tried :
1. I propsed using HMVC and the hooks which was successfull although required switch statement and rest of team werent keep on using a 3rd party code that was no longer supported.
2. We extended controller with My_Controller functionality for admin area but then put front_controller in the “controllers” directory and extended from it using a require statement ata top of each sub controller, decided this could be neater. One of the team added to the system/codeigniter.php file which was messy and would be a problem if we updated.
3. Was to create a library for each which seems ok idea but not sure if it a best practice.
Please could anyone give advice or tips ?