如何将数据发送到包含在标题中的视图?

I have one file header.php, which is included as header in other views file. so I need to send some data to the header.php.

here is my home_view:

<?php include("include/header.php"); ?>

<div class="container">
<?php include("include/sidebar.php"); ?>

 <-- here content of current view -->
</div>
<?php include("include/footer.php"); ?>

Here is controller home:

class Admin_home extends CI_Controller {
  function __construct() {
    parent::__construct();
    $this->load->model('admin/home_model');
}       
public function index() {        
if($this->session->userdata('admin_in')) {
$result = $this->admin_home_model->get_user_count();
if($result) {
$data['user_counts'] = $result; 

$this->load->view('admin/home_view', $data);  
}

I have user that data in header.php, It work properly in home_view but when I tried to load any another view in which the file header.php is also included, so it gaves the undefined index error. I expecting a way in which I can pass the data from controller to header that is included recursively in all other views.

Instead of <?php include("include/header.php"); ?> use <?php $this->load->view('header'); ?>

You can do the following instead.

View:

    div class="container">
<?php $this->load->view('sidebar'); ?>

 <-- here content of current view -->
</div>

Controller

     class Admin_home extends CI_Controller {
      function __construct() {
        parent::__construct();
        $this->load->model('admin/home_model');
    }       
    public function index() {        
    if($this->session->userdata('admin_in')) {
       $result = $this->admin_home_model->get_user_count();
    if($result) {
       $data['user_counts'] = $result; 
       $this->load->view('header');  
       $this->load->view('admin/home_view', $data);  
       $this->load->view('footer');  
    }