如何使用具有多个视图的CodeIgniter-Google-Maps-V3-API-Library?

My approach on structurizing my website is having a lot of small view files. My controllers look like this

$this->load->view('templates/header');
$this->load->view('templates/navmenu');
$this->load->view('products/create', $dat);
$this->load->view('templates/footer');

In CodeIgniter-Google-Maps-V3-API-Library examples controller passes $data variable one view file

$this->load->library('googlemaps');
$this->googlemaps->initialize();
$data['map'] = $this->googlemaps->create_map();
$this->load->view('my_view', $data);

where my_view is:

<html>
<head><?php echo $map['js']; ?></head>
<body><?php echo $map['html']; ?></body>
</html>

I have been trying to pass JS to my header view but with no success. My controller now:

$this->load->view('templates/header, $data');
$this->load->view('templates/navmenu');
$this->load->view('products/create', $data);
$this->load->view('templates/footer');

and header view file:

<html>
        <head>
                <title>CodeIgniter Tutorial</title>
                <link rel = "stylesheet" type = "text/css" href = "<?php echo base_url(); ?>css/style.css">
                <?php echo $map['js']; ?></head>
        <body>

Whatever I try to do (have spent a couple of hours) when I inspect the site I see that either JS or html part is not there.

I really liked that I had header.php view file that opened the <body> tag. It is quite easy to mix different methods on one page.

Place the below snippet in the body of the page.

<?php echo $map['html']; ?>
<?php echo $map['js']; ?>
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8"/>
    <title>Welcome to CodeIgniter</title>
    <?php echo $map['js'];?>
</head>
<body>

<div id="container">
    Welcome to GoogleMAp
    <?php echo $map['html'];?>
</div>

</body>
</html>

do like this in your view page