[eluser]seanloving[/eluser]
Thanks InsiteFX,
I have solved part of my problem and I thought it might be useful to others who might want to pass variable data to their header view files.
My problem was that I was trying to use the variable data in my
auth/header.php view file.
In my regular controllers I usually call three views - header, main, and footer like this...
Code:
$this->load->view('header', $headerdata);
$this->load->view($page, $maindata);
$this->load->view('footer', $footerdata);
This way I can send different variable data to each of my three views that generate my page.
However, in my admin controllers things are handled a bit differently. The Auth Library automatically generates three view requests based on making one single call to the
libraries/auth/view function like this:
Code:
$this->auth->view($page, $data);
which actually generates three separate view requests like this:
Code:
$this->auth->view('auth/header');
$this->auth->view('auth/pages/'.$page, $data);
$this->auth->view('auth/footer');
Notice the generated header and the footer do NOT receive $data. That was the problem.
Basically, the
$this->auth->view function in
libraries/Auth.php sends the request to the
index.php file in
views/auth.
So I modified
views/auth/index.php so that I can get $data to my
auth/header and my
auth/footer views like I like. Here is the new
views/auth/index.php file:
Code:
<?php
if(isset($data))
{
$this->load->view($this->config->item('auth_views_root') . 'header', $data);
$this->load->view($this->config->item('auth_views_root') . 'pages/'.$page, $data);
$this->load->view($this->config->item('auth_views_root') . 'footer', $data);
}
else
{
$this->load->view($this->config->item('auth_views_root') . 'header');
$this->load->view($this->config->item('auth_views_root') . 'pages/'.$page);
$this->load->view($this->config->item('auth_views_root') . 'footer');
}
?>
--seanloving