Jump to content


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

404 errros routes

  • Please log in to reply
1 reply to this topic

#1 hugoboxx

hugoboxx

    Newbie

  • Members
  • Pip
  • 1 posts

Posted 10 December 2014 - 04: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/geo.../edit.html/1002"

to the view button:

http://localhost/geo.../read.html/1002

to the add button:

href="http://localhost/geo..._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!



#2 Amit Shah

Amit Shah

    grocery CRUD Master

  • Advanced Member
  • PipPipPip
  • 1,192 posts
  • LocationMumbai, India

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







Also tagged with one or more of these keywords: 404, errros routes

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users