Starter help |
[eluser]CroNiX[/eluser]
/application/core/MY_Controller.php (Goes in /application/CORE (because you are extending /system/core/Controller.php), not a Library) Code: class MY_Controller extends CI_Controller { All other controllers that you want to have auth checked should now extend MY_Controller instead of CI_Controller.... Code: class Your_controller extends MY_Controller { Now, whenever you go to this controller, it will first load the MY_Controller and since the auth check is in it's construct, that will be executed every time before continuing on to your actual Your_controller. If you have a controller that you DON'T want auth checked, have that controller extend the regular CI_Controller instead of MY_Controller. You can take this a step further and have several "base controllers" (which is what MY_Controller is). You can have a different one for Front End, Back End, whatever, depending on the needs of your project. Here's a good article on how to take it one step further: http://philsturgeon.co.uk/blog/2010/02/C...ing-it-DRY |
Messages In This Thread |
Starter help - by El Forum - 09-06-2013, 02:03 PM
Starter help - by El Forum - 09-07-2013, 04:30 AM
Starter help - by El Forum - 09-07-2013, 10:01 AM
|