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