title: Access Database in CodeIgniter Template
body: <p>If I am setting up my template for every page as such how would I make a database call and send it as a parameter to my <code>topNav</code> page?    </p>
  
  <pre><code>$template['user']['template'] = 'user/u.template.php';
  $template['user']['regions'] = array(
     'title'      =&gt; array('content' =&gt; ""),
     'projectName'=&gt; array('content' =&gt; ''),
     'topNav'     =&gt; array('content' =&gt; $this-&gt;CI-&gt;load-&gt;view('nav/topnav.php', NULL, TRUE)),
     'subNav'     =&gt; array('content' =&gt; $this-&gt;CI-&gt;load-&gt;view('nav/subnav.php', NULL, TRUE)),
  //'footer'     =&gt; array('content' =&gt; $this-&gt;CI-&gt;load-&gt;view('user/parts/footer.v.php', NULL, TRUE)),
     'content'    =&gt; array('content' =&gt; "content")
  
  );
  </code></pre>
  
  <p>I tried to do something like so:</p>
  
  <p><code>$announcements = $this-&gt;db-&gt;get('announcements');</code> but I get,</p>
  
  <blockquote>
    <p>Message: Undefined property: MY_Loader::$db</p>
    
    <p>Filename: config/template.php</p>
  </blockquote>