Welcome Guest, Not a member yet? Register   Sign In
How do I make a database row be a global?
#9

Then you need to create ./application/core/MY_Controller.php

Then extend all of your controllers from that one.

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

/**
 * ------------------------------------------------------------------------
 * Editor   : PhpStorm 2017.1
 * Date     : 1/10/2017
 * Time     : 7:45 AM
 * Authors  : Raymond L King Sr.
 * ------------------------------------------------------------------------
 *
 * Class        MY_Controller
 *
 * @project     citest
 * @author      Raymond L King Sr.
 * @link        http://www.procoversfx.com
 * @copyright   Copyright (c) 2009 - 2017 Pro Covers FX, LLC.
 * @license     http://www.procoversfx.com/license
 * ------------------------------------------------------------------------
 */

/**
 * Class MY_Controller
 *
 * This file should be saved as:
 * ./application/core/MY_Controller.php
 *
 */
class MY_Controller extends CI_Controller {

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

    /**
     * @var  array
     */
    
protected $data = array();

    
/**
     * --------------------------------------------------------------------
     *  __construct
     * --------------------------------------------------------------------
     *
     * Class Constructor    PHP 5+
     *
     * @access    public
     */
    
public function __construct()
    {
        
parent::__construct();

        
/**
         * check to see if we want to use the CI profiler.
         * Requries the below in the ./application/config/config.php
         *
         * $config['profiler'] = FALSE;  // TRUE / FALSE
         */
        
$this->output->enable_profiler($this->config->item('profiler'));

        
log_message('debug''CI: MY_Controller class loaded');
    }

}    
// End of MY_Controller Class.

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

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

    }


}    
// End of Admin_Controller Class.

/**
 * Class Public_Controller
 */
class Public_Controller extends MY_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: How do I make a database row be a global? - by InsiteFX - 06-27-2017, 03:05 AM



Theme © iAndrew 2016 - Forum software by © MyBB