title: codeigniter - loading a library from a view?
body: <p>I have some data that I have to display as a table.</p>
  
  <p>I think I should pass the data from the controller as $data['events'] = array(.....</p>
  
  <p>and then load the view to display them.</p>
  
  <pre><code>        &lt;?php
      $this-&gt;load-&gt;library('table');
  
      echo $this-&gt;table-&gt;generate($events);
      ?&gt;
  </code></pre>
  
  <p>this doesn't work though - it gives a Fatal error: Call to a member function generate() on a non-object</p>
  
  <p>If I paste the same code in the controller, obviously using ->generate($data['events'] the table gets displayed correctly.</p>
  
  <p>Should I get that views can't load libraries, or I am doing something wrong?
  Or maybe should I capture the output of the library in the controller and send that to the view?</p>