Welcome Guest, Not a member yet? Register   Sign In
Multiple admin areas & user identification - best approach?
#2

Your MY_Controller Class can contain other classes.

Save the below as application/core/MY_Controller.php

PHP Code:
<?php
defined
('BASEPATH') OR exit('No direct script access allowed');

/**
 * ------------------------------------------------------------------------
 * Editor   : PhpStorm 2016.2.2
 * Date     : 09/29/2016
 * Time     : 7:45 AM
 * Authors  : Raymond L King Sr.
 * ------------------------------------------------------------------------
 *
 * Class        MY_Controller
 *
 * @project     starter
 * @author      Raymond L King Sr.
 * @link        http://www.procoversfx.com
 * @copyright   Copyright (c) 2009 - 2016 Pro Covers FX, LLC.
 * @license     http://www.procoversfx.com/license
 * ------------------------------------------------------------------------
 */

class Base_Controller extends CI_Controller {

    
/**
     * Class variables - public, private, protected and static.
     * --------------------------------------------------------------------
     */

    /**
     * Hold's the data for the application views
     *
     * @var array $data
     */
    
public $data = array();


    
/**
     *  __construct ()
     * --------------------------------------------------------------------
     *
     * Class Constructor
     *
     */
    
public function __construct()
    {
        
parent::__construct();


        
log_message('debug''CI : Base_Controller class loaded');


    }
    
    
// -- Add more base methods below here
    
    
    
}    // End of Base_Controller Class.


class Admin_Controller extends Base_Controller
{
    
/**
     * Class variables - public, private, protected and static.
     * --------------------------------------------------------------------
     */


    /**
     *  __construct ()
     * --------------------------------------------------------------------
     *
     * Class    Constructor
     *
     */
    
public function __construct()
    {
        
parent::__construct();

    }


}    
// End of Admin_Controller Class.


class Public_Controller extends Base_Controller
{
    
/**
     * Class variables - public, private, protected and static.
     * --------------------------------------------------------------------
     */


    /**
     *  __construct ()
     * --------------------------------------------------------------------
     *
     * Class    Constructor
     *
     */
    
public function __construct()
    {
        
parent::__construct();

    }

}    
// End of Public_Controller Class.

/**
 * ------------------------------------------------------------------------
 * Filename: MY_Controller.php
 * Location: ./application/core/MY_Controller.php
 * ------------------------------------------------------------------------
 */ 
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply


Messages In This Thread
RE: Multiple admin areas &amp; user identification - best approach? - by InsiteFX - 10-30-2016, 10:40 AM



Theme © iAndrew 2016 - Forum software by © MyBB