Welcome Guest, Not a member yet? Register   Sign In
CRUD_Model with Single Line Pagination and Lots More
#4

[eluser]ZaLiTHkA[/eluser]
Hey D13, I'm getting an error when I try use this model..

Quote:Fatal error: Class 'CRUD_Model' not found in C:\EasyPHP\www\AESPortal_CI\application\models\company_model.php on line 3

In my company_model.php file, line 3 is the start of my class:
Code:
<?php

class Company_Model extends CRUD_Model {
function __construct() {
  parent::__construct();
}

public $table = "Company";
public $primary_key = "Company.CompanyID";

public function default_select() {
  $this->db->select('Company.*');
}

public function default_order_by() {
  $this->db->order_by('Company.CompanyID');
}
}

Then in my controller I load the model at the start of my Test class:
Code:
<?php

class Test extends CI_Controller {
function index() {
  // Get Company Data
  $this->load->model('company_model');
  $company_records = $this->company->get()->result();

I did first have CRUD_Model.php in my /application/models folder, but even after moving it to the /application/core folder (as stated in the readme on Github) it still throws the same error.

I am still rather new to the world of PHP, so this may very well just be something I'm doing wrong.. Any ideas?

----------------------------------------

Update: Ok, I've managed to get it working, but I'm not sure if this is the correct way to do this...

CRUD_Model.php is in /application/models (not /application/core), and I added this to the top of my controller's index() function:
Code:
$this->load->model('crud_model');

As I say, this works.. But only if CRUD_Model.php is in my /models folder. So, am I perhaps still doing something wrong here?


Messages In This Thread
CRUD_Model with Single Line Pagination and Lots More - by El Forum - 07-08-2012, 09:39 PM
CRUD_Model with Single Line Pagination and Lots More - by El Forum - 07-13-2012, 03:11 PM
CRUD_Model with Single Line Pagination and Lots More - by El Forum - 07-19-2012, 03:20 AM
CRUD_Model with Single Line Pagination and Lots More - by El Forum - 07-24-2012, 03:42 AM
CRUD_Model with Single Line Pagination and Lots More - by El Forum - 08-16-2012, 07:58 AM
CRUD_Model with Single Line Pagination and Lots More - by El Forum - 08-16-2012, 11:11 PM
CRUD_Model with Single Line Pagination and Lots More - by El Forum - 08-18-2012, 09:42 PM
CRUD_Model with Single Line Pagination and Lots More - by El Forum - 08-19-2012, 04:53 PM



Theme © iAndrew 2016 - Forum software by © MyBB