Welcome Guest, Not a member yet? Register   Sign In
Best way to have multiple parent controllers
#12

[eluser]opel[/eluser]
Ok thanks everyone for their help, for anyone that stumbles across this here is my all my code to get multiple controllers.

At the end of config.php
Code:
/*
|--------------------------------------------------------------------------
| AUTOLOAD CONTROLLERS
|--------------------------------------------------------------------------
|
*/

function __autoload($class)
{
    if(strstr($class,'_Controller'))
    {
        include_once(APPPATH . 'libraries/' . $class . EXT);
    }
}

In libraries/MY_Controller.php (Variables can be passed to all extended controllers)

Code:
class MY_Controller extends Controller
{
    
    function MY_Controller()
    {
        parent::Controller();
        }
}
Code:
<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');

class Base_controller extends Controller
{

    public $navigation = NULL;
    public $footer = NULL;

    function Base_controller()
    {
        parent::Controller();
        $this->navigation();
        $this->footercopy();
    }


    
        function navigation()
        {
            $this->navigation['navigation'] = array("Home", "Test", "contact");
            $this->data['frontend_navigation'] = $this->load->view ('common/frontend_navigation', $this->navigation, TRUE);
        }
    
    
        function footercopy()
        {
            $this->data['footer'] = '© '.date('Y').' '.$this->config->item('project');
        }
    
}


Messages In This Thread
Best way to have multiple parent controllers - by El Forum - 05-02-2009, 05:10 PM
Best way to have multiple parent controllers - by El Forum - 05-02-2009, 05:13 PM
Best way to have multiple parent controllers - by El Forum - 05-02-2009, 05:16 PM
Best way to have multiple parent controllers - by El Forum - 05-02-2009, 06:51 PM
Best way to have multiple parent controllers - by El Forum - 05-02-2009, 09:57 PM
Best way to have multiple parent controllers - by El Forum - 05-03-2009, 01:52 AM
Best way to have multiple parent controllers - by El Forum - 05-03-2009, 03:26 AM
Best way to have multiple parent controllers - by El Forum - 05-03-2009, 03:39 AM
Best way to have multiple parent controllers - by El Forum - 05-03-2009, 03:49 AM
Best way to have multiple parent controllers - by El Forum - 05-03-2009, 04:37 AM
Best way to have multiple parent controllers - by El Forum - 05-03-2009, 05:24 AM
Best way to have multiple parent controllers - by El Forum - 05-03-2009, 09:55 AM



Theme © iAndrew 2016 - Forum software by © MyBB