how to use CodeIgniter-Google-Maps-V3-API-Library with multiple views? <p>My approach on structurizing my website is having a lot of small view files. My controllers look like this</p> <pre><code>$this-&gt;load-&gt;view('templates/header'); $this-&gt;load-&gt;view('templates/navmenu'); $this-&gt;load-&gt;view('products/create', $dat); $this-&gt;load-&gt;view('templates/footer'); </code></pre> <p>In <a href="https://github.com/BIOSTALL/CodeIgniter-Google-Maps-V3-API-Library" rel="nofollow">CodeIgniter-Google-Maps-V3-API-Library</a> examples controller passes $data variable one view file</p> <pre><code>$this-&gt;load-&gt;library('googlemaps'); $this-&gt;googlemaps-&gt;initialize(); $data['map'] = $this-&gt;googlemaps-&gt;create_map(); $this-&gt;load-&gt;view('my_view', $data); </code></pre> <p>where my_view is: </p> <pre><code>&lt;html&gt; &lt;head&gt;&lt;?php echo $map['js']; ?&gt;&lt;/head&gt; &lt;body&gt;&lt;?php echo $map['html']; ?&gt;&lt;/body&gt; &lt;/html&gt; </code></pre> <p>I have been trying to pass JS to my header view but with no success. My controller now:</p> <pre><code>$this-&gt;load-&gt;view('templates/header, $data'); $this-&gt;load-&gt;view('templates/navmenu'); $this-&gt;load-&gt;view('products/create', $data); $this-&gt;load-&gt;view('templates/footer'); </code></pre> <p>and header view file:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;CodeIgniter Tutorial&lt;/title&gt; &lt;link rel = "stylesheet" type = "text/css" href = "&lt;?php echo base_url(); ?&gt;css/style.css"&gt; &lt;?php echo $map['js']; ?&gt;&lt;/head&gt; &lt;body&gt; </code></pre> <p>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.</p> <p>I really liked that I had header.php view file that opened the <code>&lt;body&gt;</code> tag. It is quite easy to mix different methods on one page.</p>