⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Tables are showing, but I'm getting 404 when calling functions !



hugoboxx

hugoboxx
  • profile picture
  • Member

Posted 10 December 2014 - 16:41 PM

Hello everyone,

 

I'm new to GC, I've been building a site for a couple of months and everything is working fine, recently I decided to improve its functionality by including some CRUD tables via GC.

 

I've loaded a sample MYSQL table shown in one of the GC tutorials and I put all the files into the right CI folders. I've created a new method into a controller and I send the $output given by the render to the view, and that worked ok. So I can see the table, with the rigth css theme, buttons, links etc. However, I have a BIG PROBLEM, as none of the CRUD functions works I'm only getting 404 errors.

 

The controller I've got is this (I got several controllers, but the CRUD tables are for the admin only):

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

class User_admin_controller extends CI_Controller {

     function __construct()
    {
        parent::__construct();
        $this->load->database();
        $this->load->helper('url');
        $this->load->library('grocery_CRUD');
    }
     public function hour_range()
    {
        $this->grocery_crud->set_table($this->db->dbprefix('employees'));
        $output = $this->grocery_crud->render();
         $this->sendhourangetoview($output);        
    }
 
    function sendhourangetoview($output = null)
 
    {
        $this->load->view('user_manager/admin/hour_range.php',$output);    
    }
}
?>

for information I have a line into my routes.php

 $route['hour_range'] = 'user_admin_controller/hour_range';

and  on my config.php i've got some of this:

$config['url_suffix'] = '.html';
$config['base_url']    = 'http://localhost/geoda/';

the url that I see when pointing to one of the "edit buttons" is this

"http://localhost/geoda/hour_range/edit.html/1002"

to the view button:

http://localhost/geoda/hour_range/read.html/1002

to the add button:

href="http://localhost/geoda/hour_range/add.html"

 

Somehting tells me there is something to do with the routes (which are normally working fine) So, I've tried changing the 'base_url' for GC using the set_crud_url_path function, but nothing seems to work... :(

 

The only thing i can say is....PLEASE HELP!! I'm really a hand with this!


Amit Shah

Amit Shah
  • profile picture
  • Member

Posted 11 December 2014 - 04:31 AM

well i will not recommend u mingling around with routs on the basis with grocery crud... cuz may times gc looks up @the url and not the base class / method..

hence will be best to leave it unrouted