scoumbourdis / grocery-crud

Grocery CRUD is a PHP Codeigniter Framework library that creates a full functional CRUD system without the requirement of extra customisation to the JavaScripts or the CSS to do it so.
http://www.grocerycrud.com
GNU General Public License v3.0
1.01k stars 472 forks source link

Issue Installing #455

Open dziegler991 opened 6 years ago

dziegler991 commented 6 years ago

Hi all,

I am having a bit of trouble installing Grocery CRUD. It is throwing this error after following the basic steps to get it working.

An uncaught Exception was encountered Type: Error

Message: Cannot call constructor

Filename: /var/www/html/CodeIgniter/application/models/Grocery_crud_model.php

Line Number: 40

Backtrace:

File: /var/www/html/CodeIgniter/application/libraries/Grocery_CRUD.php Line: 484 Function: model

File: /var/www/html/CodeIgniter/application/libraries/Grocery_CRUD.php Line: 4607 Function: set_default_Model

File: /var/www/html/CodeIgniter/application/libraries/Grocery_CRUD.php Line: 4625 Function: pre_render

File: /var/www/html/CodeIgniter/application/controllers/Main.php Line: 27 Function: render

File: /var/www/html/CodeIgniter/index.php Line: 308 Function: require_once

The Main.php file looks like this:

<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Main extends CI_Controller {

function __construct()
{
        parent::__construct();

$this->load->database();
$this->load->helper('url');
/* ------------------ */ 

$this->load->library('grocery_CRUD');

}

public function index()
{
echo "<h1>Welcome to the world of Codeigniter</h1>";//Just an example to ensure that we get into the function
die();
}

public function ddtracker()
{
$crud = new grocery_CRUD();
$crud->set_table('ddtracker');
$output = $this->grocery_crud->render();

echo "<pre>";
print_r($output);
echo "</pre>";
die();
}
} 
/* End of file Main.php */
/* Location: ./application/controllers/Main.php */
dziegler991 commented 6 years ago

Note: this is running on php7.2 and apache2.4.x.

bvrignaud commented 6 years ago

Use first letter in upercase to class name.

Try :

$crud = new Grocery_CRUD();

instead of :

$crud = new grocery_CRUD();
dziegler991 commented 6 years ago

Unfortunately that didn't change anything

ADavidBarros commented 6 years ago

Comment out the lines from Grocery_crud_model.php file

// // function construct() // { // // parent::construct(); // } https://github.com/bcit-ci/CodeIgniter/commit/c45caeac4f45b83fbb3655f62638ebcf913981c8