• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Passing Variables from one controller to its extended controller

#1
[eluser]xtremer360[/eluser]


I'm trying to figure out how to handle a situation where I have a MY_Controller, Backend_Controller and of course the Backend extends the MY and I have other controllers like Login and other smaller controllers that extend the Backend. My question is if you notice on the login controller it needs to be able to access a variable inside of the backend controller? How can I get that variable to be used in this case?

In the backend controller I have this:

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

class Backend_Controller extends MY_Controller
{
    function __construct ()
    {
        parent::__construct();

        $this->load->library('session');

        $cms_template = $this->config->item('cms_template');

        $this->data['template'] = $cms_template;
    }
}

Here's the login controller:

Code:
<?php

if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Login extends Backend_Controller
{
    public function __construct()
    {
        parent::__construct();  
    }    

    public function index()
    {  
        $js_page_addons = '[removed][removed]';

        $page_view = 'login_view';

        $this->data['js_page_addons'] = $js_page_addons;
        $this->data['page_view'] = $page_view;
        $this->load->view('cms/' . $cms_template . '/usermanagement/index_view', $this->data);
    }
}



Messages In This Thread
Passing Variables from one controller to its extended controller - by El Forum - 01-07-2013, 12:57 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.