title: Codeigniter 3.x call to undefined method
body: <p>I am getting an error when trying to access a method inside <code>libraries/View.php</code> from <code>core/App_controller.php</code>. <code>linkJS()</code> will set markup for view output.
  Why is this method undefined and how can I overcome this?</p>
  
  <p>My folder structure</p>
  
  <p>application/core/App_controller.php</p>
  
  <pre><code>function __construct() {
    parent::__construct();
  
    $this-&gt;view = $this-&gt;load-&gt;library('view');
  
    $this-&gt;set_vars();
  }
  
  function set_vars(){
    $this-&gt;view-&gt;linkJS($this-&gt;js.'application.js');
  }
  </code></pre>
  
  <p>application/libraries/View.php</p>
  
  <pre><code>public function linkJS($src, $var = 'view_js') {
  
    if (!isset($this-&gt;vars[$var])) {
      $this-&gt;vars[$var] = {$var};
    }
    // more code ...
  }
  </code></pre>
  
  <p>From <code>views/shell.php</code> I would like to ouput <code>echo $view_js;</code></p>
  
  <p>error:</p>
  
  <blockquote>
    <p>Type: Error
        Message: Call to undefined method CI_Loader::linkJS()
        Filename: C:\xampp\htdocs\myproj\application\core\App_Controller.php</p>
  </blockquote>