php - Read works, add, edit, delete do not in Grocery Crud library Codeigniter -
i have done example , installed everything.
the read or display method of table works correctly, whenever try add, delete or edit registry windows appears , say:
404 page not found page requested not found.
here controller
class welcome extends ci_controller { public function __construct() { parent::__construct(); $this->load->model('grocery_crud_model'); $this->load->database(); $this->load->helper('url'); $this->load->library('grocery_crud'); } public function index() { $crud = new grocery_crud(); $crud->set_theme('datatables'); $crud->set_table('students'); $crud->set_relation('class','class','class'); $crud->display_as('name','name of student'); $crud->set_subject('students'); $crud->columns('name','class','roll_no'); $crud->add_fields('name','class','roll_no'); $crud->required_fields('name','class','roll_no'); $crud->unset_export(); $crud->unset_print(); $output = $crud->render(); $this->load->view('home', $output); } }
when click add button url becomes
http://localhost/index.php/add
what missed? new in codeigniter , grocery crud...
create function in welcome
controller , move of code index()
function new function like:
public function myfunction() { $crud = new grocery_crud(); $crud->set_theme('datatables'); $crud->set_table('students'); $crud->set_relation('class','class','class'); $crud->display_as('name','name of student'); $crud->set_subject('students'); $crud->columns('name','class','roll_no'); $crud->add_fields('name','class','roll_no'); $crud->required_fields('name','class','roll_no'); $crud->unset_export(); $crud->unset_print(); $output = $crud->render(); $this->load->view('home', $output); }
and redirect index()
function method:
public function index() { redirect("welcome/myfunction"); }
access grocery crud page @
http://localhost/index.php/welcome/newfunction
or simply
http://localhost/index.php/welcome
you're go now.
Comments
Post a Comment