Welcome Guest, Not a member yet? Register   Sign In
Admin controller
#6

[eluser]ntheorist[/eluser]
Hey i'm working on a similar problem. I understand building a subfolder in the controllers folder well enough, but is there a way to simulaneously have each controller in the 'admin' subfolder, extend an admin_controller file, which is itself an extend of controller, so you could add in whatever admin/security functions necessary.. ie
Code:
class Admin_Controller extends Controller
{    
    function Admin_Controller()
    {
        parent::Controller();
        
        $this->auth->authenticate(2);
        
        $this->nsite->depth_nav('Admin', 'home/');
        
        //$this->output->enable_profiler(TRUE);
    }
}
I've had this working so far for me, but the only solution i have is adding a require_once at the top of all the admin controllers, so
Code:
if ( ! defined('BASEPATH')) exit('No direct script access allowed');

require_once APPPATH.'libraries/admin_controller.php';

class Home extends Admin_Controller {

    function Home()
    
    {
        parent::Admin_Controller();
        $this->auth->validate_admin();
    }

    function index()
    {}
}
is there a better way to autodetect the access of controllers/admin or something, and then load that controller right after the controller class gets loaded? would hooks be the way to go? Autoload doesn't work for this, and i don't want to use the MY_Controller method, as i don't even want the admin functions loaded unless they're accessing controllers/admin (plus i may wish to use MY_controller for another purpose)

thx

cc


Messages In This Thread
Admin controller - by El Forum - 12-13-2008, 06:49 AM
Admin controller - by El Forum - 12-13-2008, 07:13 AM
Admin controller - by El Forum - 12-13-2008, 07:37 AM
Admin controller - by El Forum - 12-13-2008, 10:28 AM
Admin controller - by El Forum - 12-13-2008, 11:23 PM
Admin controller - by El Forum - 12-20-2008, 07:20 PM
Admin controller - by El Forum - 12-21-2008, 01:16 AM
Admin controller - by El Forum - 12-29-2008, 08:25 PM
Admin controller - by El Forum - 12-30-2008, 02:21 AM
Admin controller - by El Forum - 12-30-2008, 04:17 AM
Admin controller - by El Forum - 12-30-2008, 09:31 AM
Admin controller - by El Forum - 01-22-2009, 01:24 PM



Theme © iAndrew 2016 - Forum software by © MyBB