I followed the documentation on Models and I keep getting this error, any help would be appreciated.
A PHP Error was encountered
Severity: Notice
Message: Undefined property: Manage::$File
Filename: files/manage.php
Line Number: 14
Fatal error: Call to a member function get_files() on a non-object in /var/www/uisimulator/application/controllers/files/manage.php on line 14*
Here is my Model: - Located: application/models/files/file.php
class File extends CI_Model {
var $filename = '';
function __construct() {
parent::__construct();
}
// Return all config files
function get_files() {
$query = $this->db->get('config_files');
return $query->result();
}
function insert_file() {
$this->filename = $this->input->post('filename');
$this->db->insert('config_files', $this);
}
function update_file() {
$this->filename = $this->input->post('filename');
$this->db->update('config_files', $this, array('id' => $this->input->post('id'));
}
}
Here is my Controller: Location: application/controllers/files/manage.php
class Manage extends CI_Controller {
function __construct() {
parent::__construct();
}
public function index() {
$this->load->model('files/file', TRUE);
$config_files['query'] = $this->File->get_files();
// Load the head section
$this->load->view('head');
// Load the view, passing in the data
$this->load->view('files/index', $configFiles);
// Load Footer
$this->load->view('footer');
}
}
Inside my view I have a simple loop to show the results:
<?php foreach ($configFiles as $file) : ?>
<li><?php echo $file['filename'];?></li>
<?php endforeach;?>