Welcome Guest, Not a member yet? Register   Sign In
Processing login bar view from base controller
#1

[eluser]jacobson[/eluser]
Hello, i have a question... I have controller in which i pass the variable $data['main_content'] with the main content of the view. In order to do that i load view template

in this template i load header view, this main content and the footer. In the header view I load the login bar view.

Now I want to load this login bar in each site by using MY_Controller I've tried loading view, assigning to the variable and trying to echo variable in the header view but it didn't work :/

Code:
class MY_Controller extends CI_Controller {

    function __construct() {
        parent::__construct();
$this->load->view('includes/login_bar');
    }
}

but it doesnt work :/

my original controller

Code:
$data['main_content'] = '/main/main';
        $this->load->view('includes/template', $data);

Anyone could tell me what code should I implement in MY_Controller or give any hint :p in order to build the thing I want Tongue
#2

[eluser]jacobson[/eluser]
I've tried to process the variable
$data['credits'] = $this->data_selection_model->get_credits($this->session->userdata('username'));
(in MY_Controller)

I thought that if the main controller extends MY_Controller and in main controller i pass the $data variable to the view, it will take the $data['credits'] variable also... but the view could not recognize the $credits variable...




Theme © iAndrew 2016 - Forum software by © MyBB