ci-base-controllers
ci-base-controllers copied to clipboard
[OBSOLETE] CodeIgniter base controller classes for a better code structure.
#CodeIgniter Base Controllers CodeIgniter base controller classes for a better code structure and DRYer controller classes.
It takes advantage of PHP 5's autoloading capabilities to include a class file when that class is referenced, allowing CI libraries to extend classes that have not yet been loaded.
##Installation
- Move each file to its corresponding directory.
- Enable hooks in
application/config/config.phpfile:$config['enable_hooks'] = TRUE; - Merge repository's
hooks.phpconfig file with your own atapplication/config/hooks.phpto avoid loosing your current hooks. - If using Modular Extensions and you want the HMVC feature in place, Alter
MY_Modelto extendMX_Controllerinstead ofCI_Controllerclass.
##Usage
- Move application common logic of controllers to
application/core/Public_Controller.phporapplication/core/Admin_Controller.phpfiles or make your own, e.g.Accounts_Controller. - Alter application controller classes to extend either
Public_ControllerorAdmin_Controller(or the one you make) instead ofCI_Controllerclass. - Sample controllers can be found in
core/sample/directory.
##References and read more CodeIgniter Base Classes Revisited CodeIgniter Base Classes: Keeping it DRY